• 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;
        }
    
  • 相关阅读:
    网络编程IO模型
    网络编程四层模型
    签到赛--我打的
    签到赛--ipip
    初见RCE(远程命令/代码执行漏洞)
    [ACTF2020 新生赛]Include
    文件上传+[SUCTF 2019]CheckIn
    古典密码,背包密码,RSA
    第八章小结
    第七章小结
  • 原文地址:https://www.cnblogs.com/mxjhaima/p/15790870.html
Copyright © 2020-2023  润新知