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

nginx中的proxy_redirect的使用案例詳解

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

一 proxy_redirect的作用

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

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

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

三 案例 

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

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

這個(gè)指令:proxy_redirect http://localhost:8000/two/       http://frontend/one/;

將Location字段重寫(xiě)為http://frontend/one/some/uri/。

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

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

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

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

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

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

擴(kuò)展: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)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論