When doing node isomorphism, now I want to let nginx directly return static resources when the server is called. How should I configure nginx?
For example, visit a.xx.com/test.html,
When the node server hangs up, let nginx directly return the static file of test.html. Is there a way to achieve this?
Use proxy_intercept_errors + error_page to solve your problem.
error_page 504 /$uri
504 means that the proxy times out
We originally encountered your problem when we were publishing. When we were publishing, we needed to stop the service
But we hope to have a friendly page to remind users that we are serving and please try again later. We use nginx's load balancing to start two services. 10.0.0.2 runs to prompt users that we are releasing a version and prompts users to use the service.
However, we are already using slb for G/B issue, and the service will not be stopped during the release period. I hope it can help you. I am not very proficient in nginx. I hope there is a more clever way to solve this problem. In fact, if you write your own Lua script, you can do some customized functions. You should consider your team and time. I think It's actually best if you can do it.