最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

nginx proxy_redirect的作用及說(shuō)明

 更新時(shí)間:2024年06月05日 08:59:26   作者:hkNaruto  
這篇文章主要介紹了nginx proxy_redirect的作用及說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

準(zhǔn)備環(huán)境

springboot /redirect controller

curl http://localhost:10080/redirect -vv
*   Trying ::1:10080...
* Connected to localhost (::1) port 10080 (#0)
> GET /redirect HTTP/1.1
> Host: localhost:10080
> User-Agent: curl/7.76.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Location: http://localhost:10080/ip
< Content-Length: 0
< Date: Wed, 26 May 2021 05:55:45 GMT
< 
* Connection #0 to host localhost left intact

1. 默認(rèn)配置

即proxy_redirect default;

location / {
                proxy_pass http://localhost:10080/;
        }

效果

curl -vv http://localhost/redirect
*   Trying ::1:80...
* connect to ::1 port 80 failed: 拒絕連接
*   Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /redirect HTTP/1.1
> Host: localhost
> User-Agent: curl/7.76.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 
< Server: nginx/1.19.3
< Date: Wed, 26 May 2021 05:57:02 GMT
< Content-Length: 0
< Location: http://localhost/ip
< Connection: keep-alive
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< 
* Connection #0 to host localhost left intact

2. proxy_redirect default;

location / {
                proxy_pass http://localhost:10080/;
                proxy_redirect default;
        }

注意,proxy_redirect default必須在proxy_pass下方配置

效果

curl -vv http://localhost/redirect
*   Trying ::1:80...
* connect to ::1 port 80 failed: 拒絕連接
*   Trying 127.0.0.1:80...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /redirect HTTP/1.1
> Host: localhost
> User-Agent: curl/7.76.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 
< Server: nginx/1.19.3
< Date: Wed, 26 May 2021 06:02:20 GMT
< Content-Length: 0
< Location: http://localhost/ip
< Connection: keep-alive
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< 
* Connection #0 to host localhost left intact

與方案1等同

3. proxy_redirect off;

location / {
                proxy_pass http://localhost:10080/;
                proxy_redirect off;
        }

效果

curl http://localhost:10080/redirect -vv
*   Trying ::1:10080...
* Connected to localhost (::1) port 10080 (#0)
> GET /redirect HTTP/1.1
> Host: localhost:10080
> User-Agent: curl/7.76.1
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
< Location: http://localhost:10080/ip
< Content-Length: 0
< Date: Wed, 26 May 2021 06:03:34 GMT
< 
* Connection #0 to host localhost left intact

可以看到,302響應(yīng)的是內(nèi)部地址。

總結(jié)

常規(guī)部署情況下,不需要特別配置proxy_redirect或者配置proxy_redirect default即可。

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Nginx?跨域配置的具體實(shí)現(xiàn)

    Nginx?跨域配置的具體實(shí)現(xiàn)

    跨域資源共享是一種機(jī)制,本文主要介紹了Nginx?跨域配置的具體實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2024-09-09
  • Nginx 禁止訪問(wèn)某個(gè)目錄或文件的設(shè)置方法

    Nginx 禁止訪問(wèn)某個(gè)目錄或文件的設(shè)置方法

    如果基于WEB根目錄下,要禁止用戶訪問(wèn)/config目錄,或者要禁止用戶訪問(wèn)/config.ini(ZF常用INI,不過(guò)建議還是放到WEB目錄以外的地方),可以通過(guò)location進(jìn)行配置,返回403或者404等
    2010-09-09
  • Nginx配置http和https的實(shí)現(xiàn)步驟

    Nginx配置http和https的實(shí)現(xiàn)步驟

    Nginx是使用最多的代理服務(wù)器之一,本文主要介紹了Nginx配置http和https的實(shí)現(xiàn)步驟,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-03-03
  • 詳解Nginx服務(wù)器中HTTP Headers相關(guān)的模塊配置使用

    詳解Nginx服務(wù)器中HTTP Headers相關(guān)的模塊配置使用

    這篇文章主要介紹了詳解Nginx服務(wù)器中HTTP Headers相關(guān)的模塊配置使用,包括ngx_http_headers_module與它的增強(qiáng)版ngx_headers_more的配置使用講解,需要的朋友可以參考下
    2016-01-01
  • Nginx反向代理中出現(xiàn)502錯(cuò)誤的解決步驟

    Nginx反向代理中出現(xiàn)502錯(cuò)誤的解決步驟

    反向代理是一種服務(wù)器代理的方式,它代理了客戶端的請(qǐng)求并將請(qǐng)求轉(zhuǎn)發(fā)給后端服務(wù)器,然后將后端服務(wù)器的響應(yīng)返回給客戶端,但經(jīng)常會(huì)遇到502錯(cuò)誤,所以本文給大家介紹了Nginx反向代理中出現(xiàn)502錯(cuò)誤的解決步驟,需要的朋友可以參考下
    2025-03-03
  • nginx打印請(qǐng)求頭日志方法(親測(cè)可用)

    nginx打印請(qǐng)求頭日志方法(親測(cè)可用)

    之前想用nginx打印收到的請(qǐng)求的請(qǐng)求頭,但是只找到打印請(qǐng)求體的,沒(méi)有打印請(qǐng)求頭的,本文就來(lái)介紹一下nginx打印請(qǐng)求頭日志方法,感興趣的可以了解一下
    2023-11-11
  • nginx 平滑重啟的實(shí)現(xiàn)方法

    nginx 平滑重啟的實(shí)現(xiàn)方法

    這篇文章主要介紹了nginx 平滑重啟的實(shí)現(xiàn)方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • Nginx服務(wù)器中414錯(cuò)誤和504錯(cuò)誤的配置解決方法

    Nginx服務(wù)器中414錯(cuò)誤和504錯(cuò)誤的配置解決方法

    這篇文章主要介紹了Nginx服務(wù)器中414錯(cuò)誤和504錯(cuò)誤的配置解決方法,分別對(duì)應(yīng)Request-URI Too Large和Gateway Time-out這樣的錯(cuò)誤提示,需要的朋友可以參考下
    2015-12-12
  • Nginx設(shè)置https和http同時(shí)使用同一個(gè)端口訪問(wèn)

    Nginx設(shè)置https和http同時(shí)使用同一個(gè)端口訪問(wèn)

    本文主要介紹了Nginx通過(guò)8070端口同時(shí)支持HTTP和HTTPS的配置方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2025-05-05
  • Windows下Nginx + PHP5 的安裝與配置方法

    Windows下Nginx + PHP5 的安裝與配置方法

    Nginx 是一個(gè)輕量級(jí)的高性能 Http WebServer,以事件驅(qū)動(dòng)方式編寫,因此相比 Apache 而言,Nginx 更加穩(wěn)定、性能更好,而且配置簡(jiǎn)單,資源占用較低。以下是我在 Windows 7 安裝中 Nginx 和 PHP5.3 的步驟。
    2010-07-07

最新評(píng)論

苍山县| 临泉县| 镇宁| 长宁县| 玉环县| 遵化市| 新巴尔虎左旗| 常山县| 松溪县| 太湖县| 石城县| 修武县| 临泉县| 酉阳| 德惠市| 盘山县| 白山市| 沭阳县| 岑溪市| 五莲县| 威远县| 资中县| 安化县| 玉林市| 井研县| 佛坪县| 温泉县| 内江市| 徐水县| 从江县| 修文县| 团风县| 乌鲁木齐县| 七台河市| 靖远县| 西青区| 广宁县| 杭锦后旗| 松桃| 弥渡县| 黎川县|