nginx跨域

   location /usercenter-service {
                        more_clear_headers "Access-Control-Allow-Origin";
                        more_clear_headers "Access-Control-Allow-Methods";
                        more_clear_headers "Access-Control-Allow-Headers";
                        add_header Access-Control-Allow-Origin *;
                        add_header Access-Control-Allow-Methods 'GET, POST, PUT,DELETE';
                        add_header Access-Control-Allow-Headers 'Origin, X-Requested-With, Content-Type, Accept';

                        if ($request_method = 'OPTIONS') {
                                return 204;
                        }
            proxy_pass nginx跨域http://172.19.39.146:9055/usercenter-service;
            proxy_set_header Host $http_host;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_connect_timeout 4;
            proxy_send_timeout 1200;
            proxy_read_timeout 1200;

     }

上一篇:PHP TP5 异步请求解决跨域问题


下一篇:ubuntu 20.04 安装配置Samba服务