When nginx configures proxy_pass, the difference between the URL with "/" at the end and without "/" at the end is as follows: Note: When location is a regular expression matching pattern, the URL in proxy_pass is not allowed to have a "/" at the end, so the regular expression matching pattern is not within the scope of discussion. When the URL in the proxy_pass configuration ends with a /, when nginx forwards, it will remove the location matching expression from the original URI and append it to the URL in proxy_pass. Test address: http://192.168.171.129/test/tes.jsp Scenario 1: location ^~ /test/ { proxy_pass http://192.168.171.129:8080/server/; } The actual access address after proxy: http://192.168.171.129:8080/server/tes.jsp Scenario 2: location ^~ /test { proxy_pass http://192.168.171.129:8080/server/; } The actual access address after proxy: http://192.168.171.129:8080/server//tes.jsp Scenario 3: location ^~ /test/ { proxy_pass http://192.168.171.129:8080/; } The actual access address after proxy: http://192.168.171.129:8080/tes.jsp Scenario 4: location ^~ /test { proxy_pass http://192.168.171.129:8080/; } The actual access address after proxy: http://192.168.171.129:8080//tes.jsp When there is no / at the end of the URL in the proxy_pass configuration, if the URL does not contain path, the original URI is directly concatenated after the URL in proxy_pass; if the URL contains path, the original URI is concatenated after removing the location matching expression and the URL in proxy_pass. Test address: http://192.168.171.129/test/tes.jsp Scenario 1: location ^~ /test/{ proxy_pass http://192.168.171.129:8080/server; } The actual access address after proxy: http://192.168.171.129:8080/servertes.jsp Scenario 2: location ^~ /test { proxy_pass http://192.168.171.129:8080/server; } The actual access address after proxy: http://192.168.171.129:8080/server/tes.jsp Scenario 3: location ^~ /test/ { proxy_pass http://192.168.171.129:8080; } The actual access address after proxy: http://192.168.171.129:8080/test/tes.jsp Scenario 4: location ^~ /test { proxy_pass http://192.168.171.129:8080; } The actual access address after proxy: http://192.168.171.129:8080/test/tes.jsp This concludes this article on the differences between nginx proxy_pass with and without the end of the URL. For more information about the end of the nginx proxy_pass URL, please search 123WORDPRESS.COM's previous articles or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of Object.create instance usage in js
>>: In-depth understanding of HTML form input monitoring
Background requirements: The ERP system needs to ...
A simple license plate input component (vue) for ...
Table of contents 1. React combined with Antd to ...
Table of contents A chestnut to cover it Paramete...
This article example shares the specific code of ...
1. Concurrency Concurrency is the most important ...
1. MySQL download address; http://ftp.ntu.edu.tw/...
Today, I want to write about a "low-tech&quo...
Introduction By enabling the slow query log, MySQ...
Port mapping is not the only way to connect Docke...
This article example shares the specific code of ...
MySQL is a relational database management system....
Document hints using the show-header attribute sh...
1. Update the entire table. If the value of a col...
Preface During my internship at the company, I us...