I’m using the following setup:
– i have a webserver on which a website and some applications are hosted
– this webserver is part of a local network consisting of mulitple machines; on one of them wordpress is installed. These other machines (including the wordpress one) are not publicly accessible.
– wordpress is made publicly accessible by means of apache configuration on the webserver (using reverse proxy rules)
I’m using a plugin that uses the wp_guess_url function (defined in wp-includes/functions.php) to construct a url in the html-head section in wp-admin. Because WP_SITEURL is not defined in the config file it uses the HTTP_HOST variable to determine the url. This doesn’t work for me because wordpress is reverse proxied.
I’m now trying to determine how to best solve this problem.
First, i’m wondering what the purpose of the wp_guess_url is and why the plugin decided to use it. I’ve defined the url of my wordpress installation in the database (isn’t that mandatory?), so i’m wondering why any guessing has to be done at all. Or does this mean the plugin is poorly written? Or should i activate some kind of setting?
I don’t want to change the config file and define WP_SITEURL for two reasons:
1. I have different environments (development/staging/production), so hardcoding this is not an option
2. I like maintainability and don’t want to define the same variable in multiple places (and since it’s already defined in the database….)
I don’t know the context of why the plugin, or anything else, calls this function, it’s intent appears to be to prevent some nefarious user from accessing the admin area.
A possible workaround is to add code to your theme or child theme that pulls the site url from the database and uses it to define WP_SITEURL.
- The topic ‘wp_guess_url / plugin problem’ is closed to new replies.