nginx反向代理访问带referer的后端

来源:互联网 发布:sql 字段包含特殊字符 编辑:程序博客网 时间:2024/05/21 14:16

防外链大都是通过检查请求中的http referer来实现的。如果通过反向代理来动态指定httpreferer是不是可以解决问题。

用nginx搭一个反向代理


location/get/
{
set $hostx “”;
set $addrs “”;
if ( $uri ~ “^/get/http./+([^/]+)/(.+)$”) {
set $hostx $1;
set $addrs $2;
}
resolver 127.0.0.1;
proxy_pass http://$hostx/$addrs;
proxy_set_header referer “http://$hostx“;


proxy_set_header referer这项就是指定referer的!

源地址:http://www.jb4.net/archives/nginx-proxy-set-header-referer.html

 

我的更多文章:

    • 2012-02-2614:29:14
    • 2012-02-2613:34:58
    • 2012-02-12 22:33:11
    • 2011-12-05 22:36:00
    • 2011-11-09 22:13:59
    • 2011-11-08 21:02:43
    • 2011-11-02 22:56:20
    • 2011-09-2722:05:55
    • 2011-09-27 21:22:36
    • 2011-09-27 20:52:33
    0 0