|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66398 Clarify $_SERVER['HTTPS'] expected value with SSL-termination load balancer
Submitted: 2014-01-03 10:21 UTC Modified: -
Avg. Score:4.4 ± 0.7
Reproduced:12 of 12 (100.0%)
Same Version:7 (58.3%)
Same OS:6 (50.0%)
From: bercheg at gmail dot com Assigned:
Status: Open Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bercheg at gmail dot com
New email:
PHP Version: OS:


 [2014-01-03 10:21 UTC] bercheg at gmail dot com
From manual page:

It is pretty common for apps accessed by HTTPS to sit behind a load balancer that terminates the SSL connection and issue an plain HTTP request setting the X-FORWARDED-PROTO headers.

See and 

The documentation at states:"'HTTPS'
    Set to a non-empty value if the script was queried through the HTTPS protocol. "

but does not precise whether this variable is expected to be set when the X-FORWARDED-PROTO=HTTPS header was present, or more generally if the request was received through SSL-termination load balancer effectively making it secure.

As a result of this lack of precision in the documentation:
- some php web frameworks (e.g. ) implement the logic themselves by testing the $SERVER['X-FORWARDED-PROTO'] variable.
- some php apps that rely on $SERVER['HTTPS'] without testing against $SERVER['X-FORWARDED-PROTO'] might incorrectly assume they are queries in HTTP format, e.g.
- some php infrastructure providers (e.g. Cloud platform-as-a-service) are not clear on whether to automatically set $SERVER['HTTPS'] upon presence of X-FORWARDED-PROTO HTTP header when it is trusted to represent the originally received protocol for the request.

Suggested fix to documentation:

    Set to a non-empty value if the script was queried through the HTTPS protocol, directly or through a trusted upstream SSL-termination load balancer. "


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 23:01:30 2024 UTC