網站首頁 編程語言 正文
前置測試訪問域名:www.test.com/api/upload
1.location和proxy_pass都帶/,則真實地址不帶location匹配目錄
location /api/ {
proxy_pass http://127.0.0.1:8080/;
}
訪問地址:www.test.com/api/upload-->http://127.0.0.1:8080/upload
2.location不帶/,proxy_pass帶/,則真實地址會帶/
location /api {
proxy_pass http://127.0.0.1:8080/;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080//upload
3.location帶/,proxy_pass不帶/,則真實地址會帶location匹配目錄/api/
location /api/ {
proxy_pass http://127.0.0.1:8080;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080/api/upload
4.location和proxy_pass都不帶/,則真實地址會帶location匹配目錄/api/
location /api {
proxy_pass http://127.0.0.1:8080;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080/api/upload
5.同1,但 proxy_pass帶地址
location /api/ {
proxy_pass http://127.0.0.1:8080/server/;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080/server/upload
6.同2,但 proxy_pass帶地址,則真實地址會多個/
location /api {
proxy_pass http://127.0.0.1:8080/server/;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080/server//upload
7.同3,但 proxy_pass帶地址,則真實地址會直接連起來
location /api/ {
proxy_pass http://127.0.0.1:8080/server;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080/serverupload
8.同4,但 proxy_pass帶地址,則真實地址匹配地址會替換location匹配目錄
location /api {
proxy_pass http://127.0.0.1:8080/server;
}
訪問地址: www.test.com/api/upload-->http://127.0.0.1:8080/server/upload
總結
1.proxy_pass代理地址端口后有目錄(包括 / ),轉發后地址:代理地址+訪問URL目錄部分去除location匹配目錄?
2.proxy_pass代理地址端口后無任何,轉發后地址:代理地址+訪問URL目錄部
原文鏈接:https://blog.csdn.net/qq_37568918/article/details/121167951
相關推薦
- 2022-10-27 python中namedtuple函數的用法解析_python
- 2022-06-28 React18之狀態批處理的使用_React
- 2022-04-12 網絡編程——Http請求方式Get與Post
- 2023-04-17 Python使用future處理并發問題方案詳解_python
- 2022-07-24 Python實現FIFO緩存置換算法_python
- 2022-07-30 Python開發時報TypeError:?‘int‘?object?is?not?iterable錯
- 2022-01-19 正則表達式匹配日期格式yyyy-mm-dd(支持閏年)
- 2022-07-26 面向對象OOP基礎理解
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支