• nginx的proxy_pass到$host的问题


    做了反向代理后,由于代理服务器的nginx配置文件里有301跳转导致我的后端ajax程序有问题了,所以需要用到下面的规则过滤掉我的反向代理

    if ( $uri !~ ^/bbs/(.*)/?$ ) { //判断如果不是我的服务
        set $rule 1$rule;
    }

    if ( $uri ~* [/]+(w+)([-](w+))?$ ) { //原来的301跳转
        set $rule 2$rule;
    }

    if ( $rule = "21" ) { //原来的条件,并且不是我的服务那么执行原来的301跳转,这样我的后端服务的ajax请求就不会报错了。
        rewrite ^ $uri/ permanent;
        break;
    }

    http://blog.sina.com.cn/s/blog_57c70e190100xzsr.html

    设置proxy_host防止跨域

    http://blog.csdn.net/felix_yujing/article/details/51682655 

    反向代理后origin header丢失的问题

    http://ruby-china.org/topics/33409

    反向代理机器需要配置host

    mwbs.test.com 192.168.0.11

    nginx的server m.test.com配置下添加如下配置:

    location /bbs/ {
        proxy_store off;
        proxy_redirect off;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://mwbs.test.com/;
    }

    并且配置下只能有这一个location,否则其他location会有优先级的问题导致该配置失效

    当访问http://m.test.com/bbs/forum/index是其实就相当于访问了http://mwbs.test.com/forum/index

  • 相关阅读:
    leetcode Ch2-Dynamic Programming I
    leetcode Ch3-DFS & Backtracking II
    关于尾递归
    leetcode BFS
    linux各文件夹的作用
    auto_ptr与shared_ptr ZZ
    漏洞分析中常用的堆调试支持
    【读书笔记】Android平台的漏洞挖掘和分析
    关于Fuzz——peach的学习
    如何验证一个地址可否使用—— MmIsAddressValid函数分析
  • 原文地址:https://www.cnblogs.com/dongruiha/p/7061455.html
Copyright © 2020-2023  润新知