欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

nginx中的proxy_redirect的使用案例詳解

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

一 proxy_redirect的作用

proxy_redirect 該指令用來修改被代理服務器返回的響應頭中的Location頭域和“refresh”頭域

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

proxy_redirect 舊地址 新地址;
proxy_redirect default;  #默認配置
proxy_redirect off;   #關閉重定向

三 案例 

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

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

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

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

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

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

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

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

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

4.利用proxy_redirect這個指令可以為被代理服務器發(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/;
        }
    }

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

相關文章

最新評論