Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6419

Re: Apache and php to show http request headers.

From tony@mountifield.org (Tony Mountifield)
Newsgroups comp.lang.php
Subject Re: Apache and php to show http request headers.
Date 2012-06-25 13:36 +0000
Organization Software Insight Ltd., Winchester, UK
Message-ID <js9phr$36a$1@softins.clara.co.uk> (permalink)
References <041d6312-2dee-4535-8215-6e9dbcb1e274@z19g2000vbe.googlegroups.com> <klslb9-ogk.ln1@luuk.invalid.lan>

Show all headers | View raw


In article <klslb9-ogk.ln1@luuk.invalid.lan>, Luuk  <luuk@invalid.lan> wrote:
> On 25-06-2012 12:15, brumik wrote:
> > 
> > I need to test various http requests from an application and am using
> > Apache/PHP on ubuntu to display the http request headers. The
> > application proxy forwards http requests to the apache server's IP
> > address like as follows:
> > 
> > 192.168.40.1/test/test.html
> > 
> > where 192.168.40.1 is the apache server.
> > 
> > I have a php script to dump the headers as follows:
> > 
> > <?php
> >    foreach($_SERVER as $h=>$v)
> >      #if(ereg('HTTP_(.+)',$h,$hp))
> >        echo "<li>$h = $v</li>\n";
> >    header('Content-type: text/html');
> >   ?>
> > 
> > The problem is that to show the headers, I redirect 192.168.40.1/* to
> > the above index.php page using the following redirect:
> > 
> > Options +FollowSymlinks
> > RewriteEngine on
> > RewriteCond %{REQUEST_URI} !/index.php$
> > 
> > RewriteRule $ /index.php [R=302,L]
> > 
> > However the php request headers page always shows the URI as /
> > index.php as opposed to the 'original' URI requested (/test/
> > test.html).
> > 
> > How can I get it to show the 'original' URI requested? is this
> > something that can be done in PHP or is it apache specific?
> > 
> 
> Its apache, because it is redirecting, so PHP does only know about the
> redirected request, and does have no knowledge of how this request
> reached PHP.

You could try the Proxy flag in the RewriteRule:

RewriteRule $ http://localhost/index.php [P,L]

Cheers
Tony
-- 
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Apache and php to show http request headers. brumik <brumiku@gmail.com> - 2012-06-25 03:15 -0700
  Re: Apache and php to show http request headers. Luuk <luuk@invalid.lan> - 2012-06-25 12:55 +0200
    Re: Apache and php to show http request headers. tony@mountifield.org (Tony Mountifield) - 2012-06-25 13:36 +0000
      Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 09:41 -0400
        Re: Apache and php to show http request headers. tony@mountifield.org (Tony Mountifield) - 2012-06-25 14:42 +0000
          Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 10:44 -0400
            Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 18:10 +0200
              Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 12:48 -0400
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 19:17 +0200
                Re: Apache and php to show http request headers. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-25 10:46 -0700
                Re: Apache and php to show http request headers. The Natural Philosopher <tnp@invalid.invalid> - 2012-06-25 19:00 +0100
                Re: Apache and php to show http request headers. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-25 11:22 -0700
                Re: Apache and php to show http request headers. Luuk <luuk@invalid.lan> - 2012-06-25 21:09 +0200
                Re: Apache and php to show http request headers. The Natural Philosopher <tnp@invalid.invalid> - 2012-06-26 00:11 +0100
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 21:36 +0200
                Re: Apache and php to show http request headers. Tim Streater <timstreater@greenbee.net> - 2012-06-25 21:15 +0100
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 22:24 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 16:32 -0400
                Re: Apache and php to show http request headers. Tim Streater <timstreater@greenbee.net> - 2012-06-25 23:40 +0100
                xdebug, was Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-26 09:27 +0200
                Re: xdebug, was Re: Apache and php to show http request headers. Tim Streater <timstreater@greenbee.net> - 2012-06-26 09:47 +0100
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 21:32 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 16:33 -0400
                What can you do with PHP without a web server (Was: Apache and php to show http request headers.) "J.O. Aho" <user@example.net> - 2012-06-25 19:48 +0200
                Re: What can you do with PHP without a web server (Was: Apache and php to show http request headers.) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-25 10:59 -0700
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 15:06 -0400
                Re: Apache and php to show http request headers. "Peter H. Coffin" <hellsop@ninehells.com> - 2012-06-25 14:37 -0500
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 22:03 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 16:33 -0400
                Re: Apache and php to show http request headers. "Peter H. Coffin" <hellsop@ninehells.com> - 2012-06-25 15:57 -0500
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 23:32 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 18:11 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-27 04:36 +0200
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-27 10:11 +0200
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-28 13:18 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-28 08:40 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-28 16:16 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-28 11:44 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-28 18:01 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-28 15:05 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-29 11:18 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-29 08:40 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-30 12:26 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-30 08:07 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-07-03 12:20 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-07-03 08:44 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-07-03 16:02 +0200
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-29 14:32 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-29 08:41 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-30 12:28 +0200
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-30 08:08 -0400
                Re: Apache and php to show http request headers. Arno Welzel <usenet@arnowelzel.de> - 2012-06-30 16:48 +0200
              Re: Apache and php to show http request headers. Luuk <luuk@invalid.lan> - 2012-06-25 19:09 +0200
              Re: Apache and php to show http request headers. The Natural Philosopher <tnp@invalid.invalid> - 2012-06-25 18:55 +0100
                Re: Apache and php to show http request headers. "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-06-25 21:25 +0200
                Re: Apache and php to show http request headers. The Natural Philosopher <tnp@invalid.invalid> - 2012-06-26 00:14 +0100
                Re: Apache and php to show http request headers. Jerry Stuckle <jstucklex@attglobal.net> - 2012-06-25 19:42 -0400

csiph-web