I have two application. One is a nextjs app and another is a WordPress app. Both are running in difference instances.
In order to serve my WordPress blog from my main site like https://example.com/blog, I have added the following proxy to my main site's nginx server configuration,
location ^~ /blog/ {
http2_push_preload on;
proxy_pass https://blog.exmaple.com/;
proxy_http_version 1.1;
proxy_set_header Host blog.example.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
}
If I click on any save button from the admin portal, then it removes the 'blog' word from the URL on next load like this 'https://exmaple.com/wp-admin/options-general.php?settings-updated=true' and gives a 404 in main site when it should be like 'https://example.com/blog/wp-admin/options-general.php?settings-updated=true'.
I have updated the WordPress URLs as well. And all other URLs such as homepage, blog posts, page, media etc. are working find.
What am I doing wrong here? Please feel free to ask for more information for clarification.