我们有一个使用 nginx 的反向代理服务器。我们想在反向代理超时的情况下传递一个静态页面。
当前配置为:
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/****.crt;
ssl_certificate_key /etc/ssl/****.key;
ssl_protocols TLSv1.2 TLSv1.3;
server_name ****;
access_log /var/log/nginx/****.log;
error_log /var/log/nginx/****.log;
location / {
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 X-Forwarded-Proto $scheme;
proxy_read_timeout 30;
proxy_ssl_name $host;
proxy_ssl_server_name on;
proxy_pass https://****;
}
location /Callback/reservebalance {
proxy_pass https://****;
proxy_read_timeout 2;
proxy_connect_timeout 2;
proxy_send_timeout 2;
return this response if server times out on proxy{
default_type application/json;
return 200 '{"response":"my static response"}\n';
}
}
}