回答
收藏
分享
举报
静态资源全部请求代理后地址
提问于2021-10-01 11:32

浏览 665

我在服务器8800端口启动了一个程序,监听443端口,现在想通过配置/nexus匹配到这个8800这个端口的程序上,但是导致静态资源请求的地址全部都变成了代理后的地址,请问这个是我哪里配置的问题吗?

nginx我是这样配置的:

        listen       [::]:443 ssl http2 default_server;
location / {
}
#nexus 保留/nexus
location /nexus {
proxy_pass http://localhost:8800;
}
location ^~/nexus/static {
proxy_pass http://localhost:8800/nexus/static;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}

静态资源的请求域名全部变成了这种的,请求的是配置的代理后的地址:

http://localhost:8800/nexus/static/rapture/resources/loading-prod.css?_v=3.33.0-01&_e=OSS

已修改于2023-03-17 02:23



写下您的回答
发表回答
全部回答(1)

按点赞数排序

按时间排序

通过修改成如下配置之后可以正常访问了:

location ^~/nexus {
    proxy_pass http://localhost:8800/nexus;
    sendfile 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_set_header X-Forwarded-Proto https; # 转发时使用https协议
    proxy_request_buffering off;
    proxy_buffering off;
}

赞同

0

回复举报

回答于2021-10-09 13:54



回复源
回复
提问者
这家伙很懒还未留下介绍~
0
文章
1
问答
0
粉丝
相关问答