Hey guys this one has me stumped a little bit, any help or insight would be greatly appreciated.
I have 2 Servers, 1 IIS and 1 ARR/url rewrite. I only have one Public IP Available, so what I'm doing is forwarding all traffic to the ARR Server and offloading my SSL connections there. There are multiple Wordpess sites on this server, and I want to redirect the Admin logons to SSL. I have one Self signed SSL cert with the friendly name of wildcard (*). The URL Rewrite is as follows:
<rule name="ARR_ESXi-Prod-Web_loadbalance" patternSyntax="Wildcard" stopProcessing="false">
<match url="*" />
<action type="Rewrite" url="http://ESXi-Prod-Web/{R:0}" />
<serverVariables>
</serverVariables>
<conditions>
</conditions>
</rule>
In my Wordpress wp-config.php:
define('FORCE_SSL_ADMIN', true); define('FORCE_SSL_LOGIN', true); if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')$_SERVER['HTTPS']='on';
That part is taken from the Wordpress documentation for Admin over SSL. Now I have never done this before, but I think what that is telling me is to add a server variable so the webserver knows https is on, since the ARR server is offloading it.
So I changed my rewrite rule to:
<rule name="ARR_ESXi-Prod-Web_loadbalance" patternSyntax="Wildcard" stopProcessing="false">
<match url="*" />
<action type="Rewrite" url="http://ESXi-Prod-Web/{R:0}" />
<serverVariables>
<set name="HTTP_X_FORWARDED_PROTO" value="https" />
</serverVariables>
<conditions>
</conditions>
</rule>
And it works on multiple sites correctly. The problem is once I log into the Admin console on any site (domain.com/wp-admin) and it switches to SSL, it seems that all of my Wordpress sites break partially when viewing over regular http, like ssl is now trying to be forced for all of domain.com and not just domain.com/wp-admin. It looks like part of the page like links and pictures are fine, but all CSS and JS break because it looks like they're still trying to go over https. If I force my url back tohttps://domain.com, it will all work normally.
It seems to me that issue is with the Server variable and Im not creating it in the right way or place. Any tips on how I should be setting my rule up to accompish this?