Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.php

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-25-2012, 10:15 AM
brumik
Guest
 
Posts: n/a
Default Apache and php to show http request headers.


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?

thanks






Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-25-2012, 10:55 AM
Luuk
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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.


Reply With Quote
  #3 (permalink)  
Old 06-25-2012, 01:36 PM
Tony Mountifield
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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
Reply With Quote
  #4 (permalink)  
Old 06-25-2012, 01:41 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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]
>
> Cheers
> Tony
>


He can try a lot of things which won't work.

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


Reply With Quote
  #5 (permalink)  
Old 06-25-2012, 02:42 PM
Tony Mountifield
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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
--
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
Reply With Quote
  #6 (permalink)  
Old 06-25-2012, 02:44 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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
==================


Reply With Quote
  #7 (permalink)  
Old 06-25-2012, 04:10 PM
M. Strobel
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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.

Reply With Quote
  #8 (permalink)  
Old 06-25-2012, 04:48 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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.

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


Reply With Quote
  #9 (permalink)  
Old 06-25-2012, 05:09 PM
Luuk
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

On 25-06-2012 18:10, 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.
>


Ok,

Its about apache, the webserver that most of the time sits in front of PHP,

In their docs (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html):
An ordinary forward proxy is an intermediate server that sits between
the client and the origin server. In order to get content from the
origin server, the client sends a request to the proxy naming the origin
server as the target and the proxy then requests the content from the
origin server and returns it to the client. The client must be specially
configured to use the forward proxy to access other sites.

The important part here is:
"the proxy then requests the content from the origin server"

Therefore PHP does know nothing about a proxyserver......

Reply With Quote
  #10 (permalink)  
Old 06-25-2012, 05:17 PM
M. Strobel
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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?

/Str.

Reply With Quote
  #11 (permalink)  
Old 06-25-2012, 05:46 PM
Daniel Pitts
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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.


Reply With Quote
  #12 (permalink)  
Old 06-25-2012, 05:48 PM
J.O. Aho
Guest
 
Posts: n/a
Default What can you do with PHP without a web server (Was: Apache and phpto show http request headers.)

On 25/06/12 19:17, M. Strobel wrote:
> Am 25.06.2012 18:48, schrieb Jerry Stuckle:


>> 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?


Hmmm... you could make a GUI application as you could do with say C#.

--

//Aho


Reply With Quote
  #13 (permalink)  
Old 06-25-2012, 05:55 PM
The Natural Philosopher
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

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.
>

Jerry is always off topic then..
> /Str.
>



--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Reply With Quote
  #14 (permalink)  
Old 06-25-2012, 05:59 PM
Daniel Pitts
Guest
 
Posts: n/a
Default Re: What can you do with PHP without a web server (Was: Apache andphp to show http request headers.)

On 6/25/12 10:48 AM, J.O. Aho wrote:
> On 25/06/12 19:17, M. Strobel wrote:
>> Am 25.06.2012 18:48, schrieb Jerry Stuckle:

>
>>> 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?

>
> Hmmm... you could make a GUI application as you could do with say C#.
>

You could do anything with PHP without Apache that you could with
Apache. Apache isn't the only web server out there.

Reply With Quote
  #15 (permalink)  
Old 06-25-2012, 06:00 PM
The Natural Philosopher
Guest
 
Posts: n/a
Default Re: Apache and php to show http request headers.

Daniel Pitts wrote:
> 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.
>
>

No but then neither is a road for a car, nevertheless I wouldn't
normally consider using a car off road ...

The clue of course is in the name

"While PHP originally stood for "Personal Home Page", it is now said to
stand for "PHP: Hypertext Preprocessor"." (wiki)

Frankly I have always felt Produces HHML Pages was nearer the mark.

--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 01:37 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.