Score:0

Reverse Proxy Issue: WordPress Admin Redirects and Incorrect Static Content Serving

uz flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.