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

nginx中的proxy_redirect的使用案例詳解

 更新時間:2024年06月05日 09:29:40   作者:健康平安的活著  
proxy_redirect 該指令用來修改被代理服務(wù)器返回的響應(yīng)頭中的Location頭域和“refresh”頭域,這篇文章主要介紹了nginx中的proxy_redirect的使用案例詳解,需要的朋友可以參考下

一 proxy_redirect的作用

proxy_redirect 該指令用來修改被代理服務(wù)器返回的響應(yīng)頭中的Location頭域和“refresh”頭域。

二 語法結(jié)構(gòu)

proxy_redirect 舊地址 新地址;
proxy_redirect default;  #默認配置
proxy_redirect off;   #關(guān)閉重定向

三 案例 

如果需要修改從被代理服務(wù)器傳來的應(yīng)答頭中的"Location"和"Refresh"字段,可以用這個指令設(shè)置。

1.假設(shè)被代理服務(wù)器返回Location字段為: http://localhost:8000/two/some/uri/

這個指令:proxy_redirect http://localhost:8000/two/       http://frontend/one/;

將Location字段重寫為http://frontend/one/some/uri/。

2.在代替的字段中可以不寫服務(wù)器名:

proxy_redirect http://localhost:8000/two/ /;

這樣就使用服務(wù)器的基本名稱和端口,即使它來自非80端口。

3.參數(shù)off將在這個字段中禁止所有的proxy_redirect指令

proxy_redirect off;
proxy_redirect default;
proxy_redirect http://localhost:8000/ /; proxy_redirect ; /;1.

4.利用proxy_redirect這個指令可以為被代理服務(wù)器發(fā)出的相對重定向增加主機名: 

擴展:nginx proxy_redirect https配置后端http302跳轉(zhuǎn)處理

# HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  localhost;
        charset utf8;
        ssl_certificate      full_chain.pem;
        ssl_certificate_key  private.key;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_connect_timeout      10;
        proxy_send_timeout         90;
        proxy_read_timeout         90;
        proxy_redirect http://$host/ https://$host:$server_port/;
        location /mgr/ {
                proxy_pass http://localhost:8080/mgr/;
        }
    }

到此這篇關(guān)于nginx中的proxy_redirect的使用的文章就介紹到這了,更多相關(guān)nginx proxy_redirect的使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

恩施市| 建始县| 阿尔山市| 宁都县| 科技| 滁州市| 三门峡市| 定日县| 泉州市| 汉川市| 清远市| 凤冈县| 仁布县| 垫江县| 兴山县| 蒲城县| 达州市| 永州市| 民丰县| 集安市| 萝北县| 航空| 班玛县| 芒康县| 永城市| 贡嘎县| 珠海市| 丰城市| 交口县| 雅江县| 定远县| 永仁县| 上蔡县| 彰化县| 墨竹工卡县| 三亚市| 通河县| 天柱县| 门头沟区| 桃江县| 上虞市|