Our setup is two servers:
- One serves WP installation
- The other one is used for extra custom functionality.
Server 1 that hosts WP is using Nginx as web server and reverse proxy to Server 2.
In Server 1 we have a simple location block for reverse proxy:
location /foo/ {
proxy_pass http://1.1.1.2/foo/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
proxy_intercept_errors on;
}
In Server 2 we also have a location block because the platform requires a bit URL rewriting. It's a bit mixed bag because the platform loads some content via index.php?args but there's also static content:
location /foo/ {
index index.php;
try_files $uri $uri/ /foo/index.php?$args;
}
The problem we are facing is that while domain.com/foo/?bar, domain.com/foo/bar works great, domain.com/foo/img/photo.png gives 404.
I assume this is due try_files
but I can't seem to get it working.
Best Answer
This wasn't about reverse proxy after all. There was another regex location block in Server 1 that trapped all image requests and they didn't make it to reverse proxy at all. Problem solved.
posted again as an answer to mark the question as solved