There's an app running at app.test.example.com
that I want to make changes to, but I don't want to go through the hassle of getting the source code and getting it set up on my machine. Not when I can fake it with nginx much quicker!
app.test.example.com
depends on a service svc.test.example.com
. The main JS looks for the environment in the page URL; if I run locally at app.local.example.com
it will declare the environment to be "local" and look for a service at svc.local.example.com
.
I just have to make sure the service sees what it wants to see: a Host of svc.test.example.com
and an Origin of http://app.test.example.com
. I also need to keep the browser happy by blocking the Access-Control-Allow-Origin value the service is passing down and using my local one instead.
Works like a charm! Now I can use a try_files
directive to selectively replace JS files from the app, and fetch them from the proxied app if they don't exist locally.