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


Groups > comp.lang.php > #6422

Re: Apache and php to show http request headers.

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Apache and php to show http request headers.
Date 2012-06-25 10:44 -0400
Organization A noiseless patient Spider
Message-ID <js9tg1$pan$1@dont-email.me> (permalink)
References <041d6312-2dee-4535-8215-6e9dbcb1e274@z19g2000vbe.googlegroups.com> <klslb9-ogk.ln1@luuk.invalid.lan> <js9phr$36a$1@softins.clara.co.uk> <js9pqt$1lm$1@dont-email.me> <js9tc0$5vn$1@softins.clara.co.uk>

Show all headers | View raw


On 6/25/2012 10:42 AM, Tony Mountifield wrote:
> In article <js9pqt$1lm$1@dont-email.me>,
> Jerry Stuckle  <jstucklex@attglobal.net> wrote:
>> On 6/25/2012 9:36 AM, Tony Mountifield wrote:
>>> 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]
>>
>> He can try a lot of things which won't work.
>
> Well, yes, but I didn't think my suggestion was one of them. If you
> think it is, I would like to know why, so that I would know for the
> future, rather than just be the target of a bit of sarcasm. You could
> try something like "That won't work because...." (if applicable).
>
> The OP's original rule obviously wouldn't work, because it tells the
> client browser to generate a completely fresh request with the new
> location. In contrast, the Proxy flag in RewriteRule is supposed to
> make Apache proxy the original request to the new location (even to
> itself if necessary). So the request's original headers should still
> be present, with perhaps one or more proxy headers.
>
> Cheers
> Tony
>

It's off topic in this newsgroup.  If you want to know why, try an 
appropriate newsgroup.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

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