location / {
try_files $uri$args $uri$args/ /index.htm;
index index.html index.htm;
# 禁用 HTML 缓存
expires off;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
}
location /txsc-api {
proxy_pass http://localhost:8085/txsc-api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection $connection_upgrade;
}
# 转发请求好像只能是ip
location ^~/ai-api/ {
proxy_pass http://8.129.219.xxx:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_http_version 1.1;
# proxy_hide_header Upgrade;
add_header X-Cache $upstream_cache_status;
# 设置 Nginx 缓存
proxy_set_header Accept-Encoding "";
sub_filter "/ai-api/" "/";
sub_filter_once off;
}
# 小程序专用
location /txsc-portal-api {
proxy_pass http://localhost:8085/txsc-api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
sub_filter "/ai-api/" "/";
# proxy_set_header Connection $connection_upgrade;
}