proxy – 404 when saving settings

Question

I have 2 servers.

Server B hosts a WordPress installation (DigitalOcean Marketplace 1 click install).

Server A hosts example.com.
The blog is accessed at example.com/blog thanks to Apache proxypass:

        <Location "/blog">
                  ProxyAddHeaders On
                  ProxyPass https://10.110.0.3
                  ProxyPassReverse https://10.110.0.3
                  Header add Access-Control-Allow-Origin "*"                  
                  RequestHeader set X-Forwarded-Proto "https"
                  RequestHeader set X-Forwarded-Port "443"
        </Location>

in wp-config.php I have set

if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
        $_SERVER['HTTPS'] = 'on';
}

define('WP_HOME','https://example.com/blog');
define('WP_SITEURL','https://example.com/blog');

Everything works fine but saving the settings.
I can see that the form is submitted to the incorrect URL:

https://example.com/wp-admin/options-general.php?settings-updated=true

instead of

https://example.com/blog/wp-admin/options-general.php?settings-updated=true

How do I correct this issue?

0
flm 2 months 2022-06-13T09:35:56-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse