亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

nginx proxy_redirect的作用及說明

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

準(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即可。

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

相關(guān)文章

  • Nginx的優(yōu)化、安全與防盜鏈實例詳解

    Nginx的優(yōu)化、安全與防盜鏈實例詳解

    防止盜鏈不僅能保護(hù)版權(quán),又節(jié)約了不少流量,下面這篇文章主要給大家介紹了關(guān)于Nginx優(yōu)化、安全與防盜鏈的相關(guān)資料,文中通過圖文以及實例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-10-10
  • nginx部署多個前端項目詳細(xì)步驟

    nginx部署多個前端項目詳細(xì)步驟

    最近一臺服務(wù)器要配置多個前端項目,當(dāng)然前后端分離就需要nginx來配置了,下面這篇文章主要給大家介紹了關(guān)于nginx部署多個前端項目的詳細(xì)步驟,需要的朋友可以參考下
    2023-10-10
  • nginx 負(fù)載均衡的三種參數(shù)設(shè)置

    nginx 負(fù)載均衡的三種參數(shù)設(shè)置

    這篇文章主要介紹了nginx 負(fù)載均衡的三種參數(shù)設(shè)置,需要的朋友可以參考下
    2017-07-07
  • 利用Nginx反向代理解決跨域問題詳解

    利用Nginx反向代理解決跨域問題詳解

    這篇文章主要介紹了利用Nginx反向代理解決跨域問題詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-02-02
  • CentOS 7中利用yum安裝Nginx的方法教程

    CentOS 7中利用yum安裝Nginx的方法教程

    這篇文章主要給大家介紹了在CentOS 7中利用yum安裝Nginx的方法教程,文中給出了詳細(xì)的步驟介紹,對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。
    2017-05-05
  • nginx添加http_ssl_module并且配置域名指定端口的操作方法

    nginx添加http_ssl_module并且配置域名指定端口的操作方法

    這篇文章主要介紹了nginx添加http_ssl_module并且配置域名指定端口的操作方法,文末附帶linux下防火墻和開放端口,需要的朋友可以參考下
    2023-11-11
  • Nginx中配置防盜鏈的方法實現(xiàn)

    Nginx中配置防盜鏈的方法實現(xiàn)

    在數(shù)字化時代,保護(hù)網(wǎng)站內(nèi)容免受盜鏈至關(guān)重要,Nginx防盜鏈通過檢查請求頭Referer字段來拒絕非法來源請求,本文就來詳細(xì)的介紹一下,感興趣的可以了解一下
    2024-10-10
  • Nginx部署JavaWeb項目全過程

    Nginx部署JavaWeb項目全過程

    這篇文章主要介紹了Nginx部署JavaWeb項目全過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • nginx pod hook鉤子優(yōu)雅關(guān)閉示例詳解

    nginx pod hook鉤子優(yōu)雅關(guān)閉示例詳解

    這篇文章主要為大家介紹了nginx pod hook鉤子優(yōu)雅關(guān)閉示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-11-11
  • Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator安裝配置文字版

    Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator安裝配置文字版

    把我架設(shè)lnmp網(wǎng)站的過程寫出來,希望對想架設(shè)網(wǎng)站的朋友有所幫助,如有更好的辦法請?zhí)岢鰜?/div> 2012-02-02

最新評論