Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55971 new defect (bug)

saving settings returns 404 - WP_SITEURL not used?

Reported by: mommens's profile mommens Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.0
Component: General Keywords:
Focuses: Cc:

Description

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 apart from saving the settings that return a 404.
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

Change History (2)

#1 @mommens
2 years ago

The settings are actually saved. But we're not redirected to the right page afterward.

#2 @mommens
2 years ago

Adding these redirects to Apache corrects all failing settings:

        RedirectMatch /wp-admin/options-general.php /blog/wp-admin/options-general.php
        RedirectMatch /wp-admin/options-writing.php /blog/wp-admin/options-writing.php
	RedirectMatch /wp-admin/options-reading.php /blog/wp-admin/options-reading.php
        RedirectMatch /wp-admin/options-discussion.php /blog/wp-admin/options-discussion.php
        RedirectMatch /wp-admin/options-media.php /blog/wp-admin/options-media.php

But that's only a hack.

Note: See TracTickets for help on using tickets.