I have a configuration issue with my website setup involving a reverse proxy and WordPress. Currently, I have two domains: example.com hosted on server A and example.net hosted on server B. To display the content of example.net on example.com/blog, I set up a reverse proxy on server A.
I also changed the site URL in the admin area of example.net to example.com/blog, so all links to posts and pages would update accordingly. However, I'm encountering a problem accessing the admin area from example.com/blog/wp_admin. It keeps redirecting me to example.net/wp_admin. When I try changing the WordPress URL to example.com/blog, I receive an internal server error.
Additionally, when browsing example.com/blog, all static content like post images are being served from example.net. This causes issues with downloading certain files like fonts because they are being blocked.
I want to highlight that on server A, where example.com is hosted, I'm using the following configuration for Nginx. It's important to note that both example.com and example.net are behind Cloudflare DNS.
location /blog/ {
proxy_pass http://example.net/;
proxy_read_timeout 90;
proxy_connect_timeout 90;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host example.net;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
}
How can I resolve the issue with accessing the WordPress admin area from example.com/blog/wp_admin and ensure that static content is served correctly from example.com when browsing example.com/blog?