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;
        }
    
  • 相关阅读:
    近来感受
    GIT相关命令
    CMMI评审总结
    Windows下Git Bash的设置
    PHP学习三--常用运算符和结构语句
    PHP学习二--常量
    MYSQL基础十一--存储引擎
    MYSQL基础十--存储过程
    MYSQL基础九--自定义函数
    MYSQL基础八--子查询和连接
  • 原文地址:https://www.cnblogs.com/mxjhaima/p/15790870.html
Copyright © 2011-2022 走看看