When using nginx as a reverse proxy, you can simply forward the request directly to the next service as is. Setting a proxy_pass request will only replace the domain name, if you want to access different services based on different url suffixes, you need to go through the following method.

options 1: Add “/”

Shell

^~/user/ matches requests prefixed with user, and proxy_pass ends with /, then the path after /user/* is spliced directly to the end, i.e. user is removed.

options 2: rewrite

Shell

proxy_pass does not have / at the end, and rewrite rewrites the url.

Leave a Reply

Your email address will not be published. Required fields are marked *