解决 nginx https反向代理http协议 302重定向localtion到http问题

时间:2021-07-19 16:42:28

location /rest {
#proxy_redirect off;
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_pass http://192.168.0.231:8081/rest;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect http:// $scheme://;

if ($request_filename ~* .*.(html|htm)$)
{
expires -1s;
}
if ($request_filename ~* .*.(gif|jpg|jpeg|png|bmp|swf)$)
{
expires 30d;
}
if ($request_filename ~ .*.(js|css)$)
{
expires 12h;
}
}