passing header information on to backend Apache/PHP

Peter Langhans peter.langhans at incipience.co.uk
Sun Apr 5 19:57:58 MSD 2009


Hi Gena,

thx for the reply. Works perfectly as well!

Bests,
Pete

On Sun, Apr 5, 2009 at 4:26 PM, Gena Makhomed <gmm at csdoc.com> wrote:

> On Sunday, April 5, 2009 at 16:02:34, Peter Langhans wrote:
>
> PL> My problem is, that I need my php scripts to know
> PL> in some way or another whether SSL is used or not
> PL> (to include either https or http javascript files e.g.).
>
> PL> When using nginx as webfrontend proxy, it accepts all the ssl
> PL> connections and it's working fine, but when I proxy through to
> PL> apache, the knowledge about SSL is 'lost'. If possible, I don't
> PL> want to be using different ports for proxying through to apache.
> ...
> PL> Does anyone have an idea how I can get any custom set header,
> PL> set in the nginx.conf through to the php scripts?
>
> nginx config:
> =============
>
> proxy_set_header X-Nginx-Scheme $scheme;
>
> # nginx variable $scheme will be 'http' or 'https'.
>
> apache config:
> ==============
>
> SetEnvIf X-Nginx-Scheme "^https$" HTTPS=on
>
> # Apache environment variable HTTPS will be 'on' or not defined.
>
> PHP code:
> =========
>
> $scheme = getenv('HTTPS') && strtolower(getenv('HTTPS')) != 'off'
>    ? 'https'
>    : 'http';
>
> # PHP variable $scheme will be 'http' or 'https'.
>
> --
> Best regards,
>  Gena
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090405/4c6e89f0/attachment.html>


More information about the nginx mailing list