TL;DR 80或者443的 nginx 增加 1 2 3 4 5 6 7 8 9 10 11 12 13 location / { proxy_pass http://127.0.0.1:8612/; add_header Access-Control-Allow-Methods *; add_header Access-Control-Max-Age 3600; add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Credentials true; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; #要透传的协议 proxy_set_header X-Forwarded-Port $server_port; #要透传的接口 if ($request_method = OPTIONS){ return