Skip to content
This repository has been archived by the owner on Feb 23, 2019. It is now read-only.

Add support for X-Forwarded-Proto to identify HTTPS protocol #520

Merged
merged 3 commits into from
Aug 18, 2017
Merged

Add support for X-Forwarded-Proto to identify HTTPS protocol #520

merged 3 commits into from
Aug 18, 2017

Conversation

marian-kadanka
Copy link

Support X-Forwarded-Proto header since it is used in some proxy or
load balancer environments to identify HTTPS protocol - nor HTTPS,
nor SERVER_PORT variable is available in those scenarios to
identify the protocol used.

More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto

Support X-Forwarded-Proto header since it is used in some proxy or
load balancer environments to identify HTTPS protocol. More info:
developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto
@nigrosimone
Copy link
Collaborator

nigrosimone commented Aug 16, 2017

before merging, please update readme.md with a new line into the changelog, eg.

:diamond_shape_with_a_dot_inside: Update | [Add support for X-Forwarded-Proto to identify HTTPS protocol](https://github.com/szepeviktor/w3-total-cache-fixed/pull/520) |

thanks for contributng to this project.

@marian-kadanka
Copy link
Author

I've just added the line to the readme.md, thank you for the advice.

@nigrosimone
Copy link
Collaborator

Thanks, but please add the new line at the end of the list

@marian-kadanka
Copy link
Author

Sorry, but there is the new line at the end of the list, should I add another one?

@nigrosimone
Copy link
Collaborator

Move your line at the end of the list. We add all change at the end of the list.

@marian-kadanka
Copy link
Author

Ah, sorry, didn't get it... done.

@nigrosimone nigrosimone merged commit 0f2b7d6 into szepeviktor:v0.9.5.x Aug 18, 2017
@karlsoon
Copy link

karlsoon commented Nov 1, 2017

does it is affects nginx?

@charlesLF
Copy link
Collaborator

charlesLF commented Nov 2, 2017

@karlsoon : I just checked the commits in this PR, and it doesn't seem nginx was included.

There would need to be an additional "if" added in PgCache_Environment.php#1048, but I'm not a big fan of the use of "if's" in nginx (see If is Evil).

It'd be something like this:

		if ( $config->get_boolean( 'pgcache.cache.ssl' ) ) {
			$rules .= "set \$w3tc_ssl \"\";\n";

			$rules .= "if (\$http_x_forwarded_proto = https) {\n";
			$rules .= "    set \$w3tc_ssl _ssl;\n";
			$rules .= "}\n";

			$rules .= "if (\$scheme = https) {\n";
			$rules .= "    set \$w3tc_ssl _ssl;\n";
			$rules .= "}\n";

			$env_w3tc_ssl = "\$w3tc_ssl";
		}

Warning: I haven't tested it.

You can give it a try and let us know if it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants