zoukankan      html  css  js  c++  java
  • 2022年工作积累

    2022年1月

    有的时候我们往往只是因为自己的一点小失误(粗心)而前功尽弃,没那么严重的情况下也可能会折腾而耽误不少时间

     location /mxz {
             if ($request_method = 'OPTIONS') {
                     add_header Access-Control-Allow-Origin $http_origin;
                     add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH,OPTIONS;
                     add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
                     return 204;
            }
            proxy_pass http://49.233.205.96:8815;
            rewrite  ^.+mxz/?(.*)$ /$1 break;
    
            add_header Access-Control-Allow-Origin $http_origin always;
            add_header Access-Control-Allow-Methods *;
            add_header Access-Control-Allow-Credentials true;
            add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    

    这样一段配置,本身是从之前的配置中拷贝过来修改了一下转发规则,但是拷贝的时候因为终端显示的时候自动换行了,直接用鼠标覆盖的方式去复制,结果导致复制后的配置换行,重启nginx并不报错,但这样配置出来的路径竟然出现了跨域问题。在vim模式下编辑这个配置文件,完全感觉不到区别,一个是自动换行了,一个是拷贝后多了一个换行符。

     location /mxz {
             if ($request_method = 'OPTIONS') {
                     add_header Access-Control-Allow-Origin $http_origin;
                     add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH,OPTIONS;
                     add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-
                     With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
                     return 204;
            }
            proxy_pass http://49.233.205.96:8815;
            rewrite  ^.+mxz/?(.*)$ /$1 break;
    
            add_header Access-Control-Allow-Origin $http_origin always;
            add_header Access-Control-Allow-Methods *;
            add_header Access-Control-Allow-Credentials true;
            add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,
            If-Modified-Since,Cache-Control,Content-Type,Authorization';
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    
  • 相关阅读:
    文件操作_1-24 选择题
    文件操作_1-22 选择题
    文件操作_1-21 选择题
    druid与知乎平台
    b树和b+树
    mybatis generator的generatorConfig.xml配置详解
    logback日志配置文件
    单链表每k个节点为一组进行反转(最后不满k个时不反转)
    单链表每k个节点一组进行反转(最后不足k个也反转)
    shell 结合expect实现ssh登录并执行命令
  • 原文地址:https://www.cnblogs.com/mxjhaima/p/15790870.html
Copyright © 2011-2022 走看看