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


Groups > comp.lang.php > #6436

Re: Apache and php to show http request headers.

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: Apache and php to show http request headers.
Date 2012-06-25 21:32 +0200
Message-ID <a4rsmtFgd7U1@mid.uni-berlin.de> (permalink)
References (5 earlier) <js9tg1$pan$1@dont-email.me> <a4rgsaFj6nU1@mid.uni-berlin.de> <jsa4pd$8ij$1@dont-email.me> <a4rkp6FhomU1@mid.uni-berlin.de> <%t1Gr.28393$Bp1.24038@newsfe10.iad>

Show all headers | View raw


Am 25.06.2012 19:46, schrieb Daniel Pitts:
> On 6/25/12 10:17 AM, M. Strobel wrote:
>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:
>>> On 6/25/2012 12:10 PM, M. Strobel wrote:
>>>> Am 25.06.2012 16:44, schrieb Jerry Stuckle:
>>>>> 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.
>>>>>
>>>>
>>>> Truth is never off topic.
>>>>
>>>> /Str.
>>>>
>>>
>>> Only in your small mind.  This is a PHP group - hence the "PHP" in its name.  There
>>> are other groups where experts in that area hang out.
>>>
>>> And your comment shows why there are so many crappy answers to off-topic questions in
>>> this newsgroup.
>>>
>> Ah, small mind. What could PHP do without Apache servers?
> Quite a bit. Apache isn't a requirement for PHP by any means.

Who is talking about requirement?

The point was JS saying Apache is off topic for PHP, and I tried to hint to the
importance of Apache for PHP web programming.

see http://phpadvent.org/2010/usage-statistics-by-ilia-alshanetsky

/Str.


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