ai-chatbot/deploy/nginx/pascal-service.conf.template

82 lines
2.9 KiB
Plaintext

# Include this file inside the authenticated bbyy.ai HTTPS server block.
# Replace __PASCAL_PROXY_SECRET__ during deployment and chmod the rendered file 600.
location = /_pascal_auth {
internal;
proxy_pass http://__MAIN_NGINX_UPSTREAM__/api/internal/pascal/access;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Pascal-Proxy-Secret "__PASCAL_PROXY_SECRET__";
}
location = __PASCAL_BASE_PATH__ {
return 302 __PASCAL_BASE_PATH__/scenes;
}
# Production uses Webpack content-hashed chunk names, so changed assets always
# receive a new URL and can be cached immutably without crossing deployments.
# Static assets contain no user data and need no auth subrequest.
location ^~ __PASCAL_BASE_PATH__/_next/static/ {
proxy_pass http://__PASCAL_NGINX_UPSTREAM__;
proxy_http_version 1.1;
proxy_hide_header X-Powered-By;
proxy_hide_header Cache-Control;
proxy_hide_header Expires;
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_buffering on;
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
location ^~ __PASCAL_BASE_PATH__/icons/ {
proxy_pass http://__PASCAL_NGINX_UPSTREAM__;
proxy_http_version 1.1;
proxy_hide_header X-Powered-By;
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_buffering on;
expires 7d;
add_header Cache-Control "public, max-age=604800" always;
}
location ^~ __PASCAL_BASE_PATH__/audios/ {
proxy_pass http://__PASCAL_NGINX_UPSTREAM__;
proxy_http_version 1.1;
proxy_hide_header X-Powered-By;
proxy_set_header Host $host;
proxy_set_header Connection "";
proxy_buffering on;
expires 7d;
add_header Cache-Control "public, max-age=604800" always;
}
location ^~ __PASCAL_BASE_PATH__/ {
auth_request /_pascal_auth;
auth_request_set $pascal_user_id $upstream_http_x_pascal_user_id;
proxy_pass http://__PASCAL_NGINX_UPSTREAM__;
proxy_http_version 1.1;
proxy_hide_header X-Powered-By;
proxy_set_header Host $host;
proxy_set_header Cookie "";
proxy_set_header Authorization "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Pascal-User-Id $pascal_user_id;
proxy_set_header X-Pascal-Agent-Proxy-Secret "__PASCAL_PROXY_SECRET__";
proxy_set_header X-Pascal-Scene-Token "__PASCAL_PROXY_SECRET__";
proxy_set_header Connection "";
proxy_buffering off;
proxy_request_buffering off;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
proxy_connect_timeout 30s;
}