My question is similar to Nginx Relative URL to Absolute Rewrite Rule? - but with an added twist.
I have nginx acting as a proxy, which is a proxy for several applications, similar to this (simplified) configuration:
server { listen 80; server_name example.com; location /app1 { proxy_pass http://app1.com; } location /app2 { proxy_pass http://app2.com; } }
This works great, but as in the other question, these applications ( app1 and app2 ) use relative URLs like /css/foo.css or /js/bar.js . There is also a big problem to ask all applications to change something like /app1/css/foo.css .
Is it possible for nginx to reasonably determine which application should process the request? FTR, users will access these applications as follows:
http://example.com/app1/fooaction or http://example.com/app2/baraction .
If that matters, all applications are Java / Tomcat-based applications.
TIA!
source share