0

Wordpress is working fine if using http://localhost:8091/ to login and browse; however, using https://www.website.net/blog/ will only let me browse -- login is not working.

------------             ----------            ------------------------
| Internet | <- HTTPS -> | Apache | <- HTTP -> | IIS (localhost:8091) |
| Request  |             | Proxy  |            | Wordpress            |
------------             ----------            ------------------------

Request  
from: https://www.website.com/blog/            
to: http://localhost:8091/

Wordpress Server hosted by IIS (http://localhost:8091/), and proxy (Apache 2.4) is on same box OS Windows 10 pro. I have .htaccess file.

Wordpress wp_options table

home is http://localhost:8091
siteurl is http://localhost:8091

Apache conf

<VirtualHost www.website.com:443>
  ...
  <IfModule mod_proxy.c>    
    ProxyRequests Off   
    ProxyPass           /blog/          http://localhost:8091/
    ProxyPassReverse    /blog/          http://localhost:8091/
    ...
  </IfModule>
  ...
  <Proxy "http://localhost:8091">
    SetOutputFilter proxy-html
    ProxyHTMLEnable on
    ProxyHTMLExtended on        
    ProxyHTMLURLMap http://localhost:8091/ https://www.website.com/blog/
  </Proxy>
  ...
</VirtualHost>

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="index.php" />
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>

Would I need to change my web.config file (translator) to something else?

URL after failed login attempt is https://www.websit.com/blog/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%3A8091%2Fwp-admin%2F&reauth=1

I tried to dig deep into the WP code to figure out where $redirect_to = is declared. I am getting (33 hits in 7 files) ... somehow not very transparent.

It sound like this post is somewhat related, if there is a cookies problem. I do not know how to circumvent this with my setup.

wp-config.php added this, but it is still not working:

if ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ) {
    $_SERVER['HTTP_HOST'] = str_replace("http","https",$_SERVER['HTTP_X_FORWARDED_HOST']);
}

I found this to be working somewhat. I am still tracking some https problems, but over all it gave me what I was looking for. Add it just before the line that reads "That's all, ..." to your wp-config.php file

/* Multisite Redirect Loop fix */
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

/* That's all, stop editing! Happy blogging. */

UPDATE:

I did not get Wordpress SSL and non-SSL setup part to work. The UI was getting buggy. And SSL plugins would not fix the problems. I ended up moving the host from IIS to Apache, and removing the proxy setup all together. Now it WP works.

If you do have any suggestions on how to get this proxy to work, please share.

3
  • the proxy sounds like a pointless idea. why would you want such a thing? Commented Jun 17, 2018 at 15:16
  • your main problem is probably not detecting correctly that you are on https. You should use an https url for the site url and home url options Commented Jun 17, 2018 at 15:18
  • The server has been setup to use Apache as front-end and IIS as local host. The websites are all hosted from IIS, but under localhost. Apache is taking care of all SSL calls, cleaning up HTML and compressing the pages. Somehow WP did not allow me to use it in such a way - but got it now working by hosting it without proxy.
    – MeSo2
    Commented Jun 17, 2018 at 23:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.