比如:
访问 https://host/path/case/:id 的时候
id 可以是任何值。
应该映射到 ttps://host2/static/path/case/code/index.html
起初我是这么配置的
location /path/case/ {
proxy_pass https://ip/path/case/code/index.html
...
}
这样没有用。
比如:
访问 https://host/path/case/:id 的时候
id 可以是任何值。
应该映射到 ttps://host2/static/path/case/code/index.html
起初我是这么配置的
location /path/case/ {
proxy_pass https://ip/path/case/code/index.html
...
}
这样没有用。
可以用rewrite来重写链接的
rewrite /path/case/:id([0-9]+) /static/path/case/code/index.html redirect;
rewrite /path/case/:id([0-9]+) https://ip/path/case/code/ind... redirect;
已参与了 SegmentFault 思否社区 10 周年「问答」打卡 ,欢迎正在阅读的你也加入。
这样配置没问题,我觉得你配置完是不是没有重启nginx
nginx -s reload
已参与了 SegmentFault 思否社区 10 周年「问答」打卡 ,欢迎正在阅读的你也加入。
15 回答8.4k 阅读
2 回答2.4k 阅读✓ 已解决
1 回答1.8k 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
3 回答898 阅读
1 回答778 阅读
1 回答620 阅读
这样是没问题的。
不过我在想,你的 id 是不是拼在了 html 后面。