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;
        }
    
  • 相关阅读:
    工业相机基础知识
    软件测试最常用的 SQL 命令 | 掌握基本查询、条件查询、聚合查询
    一文掌握软件测试常用SQL命令
    PageObject设计模式在 UI 自动化中的实践(QQ 邮箱登陆为例)
    测试开发必备--搞定PO设计模式
    Junit5 + YAML 参数化和数据驱动,让 App 自动化测试更高效(一)
    快速搞定APP移动端自动化测试
    接口自动化测试的 “能” 与 “不能”
    如何精通接口测试?
    测试开发必备:Dubbo-admin+Zookeeper 的环境搭建实操
  • 原文地址:https://www.cnblogs.com/mxjhaima/p/15790870.html
Copyright © 2011-2022 走看看