0

I currently have the following configuration in nginx:

    location ~* .(png|gif|ico|jpg|jpeg|css|js|svg|woff2|ttf)(\?.*)?$ {
        proxy_pass http://nodejs;
    }

    location / {
      return 302 /;
    }

This results in all URLs except for known static files to be redirected to the root.

However, I was wondering if it's possible to have nginx just reverse proxy the content of root with a 200, rather than perform a redirect?

Note that try_files /; instead of return 302 /; based on some other question/answer didn't work, not sure if that's exactly what I should've tried or not. (Is try_files based on the local file system?? Not applicable here.)

1 Answer 1

0

The directive proxy_pass can be applied per location, so you configure every location to fetch its content from a different back end server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.