28 lines
808 B
Plaintext
28 lines
808 B
Plaintext
server {
|
|
listen 1998;
|
|
server_name localhost;
|
|
|
|
location /v3/ {
|
|
proxy_pass https://restapi.amap.com/v3/;
|
|
|
|
# 必须设置,否则高德服务器可能会拒绝请求
|
|
proxy_set_header Host restapi.amap.com;
|
|
|
|
# 核心:确保 SSL 握手时发送正确的域名
|
|
proxy_ssl_name restapi.amap.com;
|
|
proxy_ssl_server_name on;
|
|
proxy_ssl_protocols TLSv1.2 TLSv1.3;
|
|
|
|
# 常规转发头
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
# 优化连接
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
|
|
# 增加超时控制,防止 API 响应慢导致连接堆积
|
|
proxy_connect_timeout 10s;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
} |