I have a Ruby on Rails application and a Wordpress blog hosted on separate EC2 instances.
I'm trying to make the Wordpress blog to act like a subfolder of the Rails application (example.com/blog instead of blog.example.com) for better SEO
- The Rails application can be accessed through http and https (http is redirecting to https)
https://www.nginx.com/resources/admin-guide/reverse-proxy/
I tried using nginx reverse proxy function and I think it's my best option right now but my attempt was unsuccessful.
- The main page of the blog opens as expected (example.com/blog) but without css.
- A URL with arguements (example.com/blog/args) redirects me back to the Rails application (example.com/args)
I set the desired blog url in wp-config.php as the following:
define('WP_SITEURL', 'https://www.example.com/blog');
define('WP_HOME', 'https://www.example.com/blog');
This is the nginx configuration I use:
location ^~ /blog {
proxy_pass http://<<BLOGIP>>/blog;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
- https://github.com/waterlink/rack-reverse-proxy
I also tried the rack-reverse-proxy gem but got the same result
It's really important for the Rails application and the Wordpress blog to stay separated for auto-scaling, redundancy and deployment purposes.
If there's another way achieving this, I'm open to suggestions.

https://www.example.com/blogthen it would be easier to proxy_pass