Welcome! Log In Create A New Profile

Advanced

Re: passing header information on to backend Apache/PHP

Peter Langhans
April 05, 2009 10:25AM
Larry,

thanks for your reply again. Sorry I stole your time for my own dumbness.

It's totally possible to do it via headers. The example I gave above, works
perfectly. I have just been too dump to test it in https (I tested in http)
and wondered why the header does not come through as expected :( Oh lord.

So just for reference. As the manual states correctly, you can pass any
header information on to your backend scripts via the

proxy_set_header Header-Name Header-Vale;

directive. Apache does NOT filter it out, and it's visible within PHP by
using one of the two following options:

1.) use the normal $_SESSION variable. CAVEAT: when using the $_SESSION
variable your header "Header-Name" becomes "HTTP_HEADER_NAME" (watch casing
and underscore instead of dash)

2.) use the apache_request_headers function to retrieve original/unchanged
values (http://uk.php.net/apache_request_headers)

Thanks for your time, folks!

Pete

On Sun, Apr 5, 2009 at 2:40 PM, Larry Bates wrote:

> What about passing parameter to your PHP script using rewrite rule?
>
> rewrite ^(.*)$ http:///
> login.php?proto=SSL
>
> I might not be understanding your exact problem though.
>
> -Larry Bates
>
> ------------------------------
> *From:* owner-nginx@sysoev.ru [mailto:owner-nginx@sysoev.ru] *On Behalf Of
> *Peter Langhans
> *Sent:* Sunday, April 05, 2009 8:03 AM
> *To:* nginx@sysoev.ru
> *Subject:* passing header information on to backend Apache/PHP
>
> Hi,
>
> I'm using nginx 0.6.35, apache 2.0.63 and php 5.2.9.
>
> My problem is, that I need my php scripts to know in some way or another
> whether SSL is used or not (to include either https or http javascript files
> e.g.).
>
> When using nginx as webfrontend proxy, it accepts all the ssl connections
> and it's working fine, but when I proxy through to apache, the knowledge
> about SSL is 'lost'. If possible, I don't want to be using different ports
> for proxying through to apache.
>
> I thought it'd be enough to set headers like:
>
> for 80:
> proxy_set_header X-Secure of;
>
> for 443:
> proxy_set_header X-Secure on;
>
> put I have not found a way how I could retrieve those values from within
> the php script. They seem to be filtered out by Apache.
>
> Does anyone have an idea how I can get any custom set header, set in the
> nginx.conf through to the php scripts?
>
> Thanks a lot,
> Peter
>
Subject Author Posted

passing header information on to backend Apache/PHP

Peter Langhans April 05, 2009 09:02AM

RE: passing header information on to backend Apache/PHP

lbates35406 April 05, 2009 09:37AM

Re: passing header information on to backend Apache/PHP

Peter Langhans April 05, 2009 09:57AM

RE: passing header information on to backend Apache/PHP

lbates35406 April 05, 2009 09:40AM

Re: passing header information on to backend Apache/PHP

Peter Langhans April 05, 2009 10:25AM

Re: passing header information on to backend Apache/PHP

anomalizer April 05, 2009 10:32AM

Re: passing header information on to backend Apache/PHP

Gena Makhomed April 05, 2009 11:26AM

Re: passing header information on to backend Apache/PHP

Peter Langhans April 05, 2009 11:57AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 245
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready