http - nginx反向代理意外重定向
问题描述
我有 nginx 作为反向代理运行,配置 /etc/nginx/sites-enabled/10.0.0.1.conf
server {
listen 80;
server_name 10.0.0.1;
location /blog/ {
proxy_pass http://127.0.0.1:8080/;
}
}
以及在 127.0.0.1:8080 上运行的博客服务。
当我在机器上查询 http://localhost/blog/ 时,我从博客服务中得到了预期的响应。但是,当从http://10.0.0.1/blog/查询时, nginx 会重定向到http://10.0.0.1,仅此而已。
这个配置有什么问题?为什么http://10.0.0.1/blog/不反向代理到 http://localhost:8080 博客服务?
nginx版本:nginx/1.18.0(Ubuntu)
解决方案
这是 chrome 缓存来自 nginx 对http://10.0.0.1/blog/的旧响应。清除浏览器缓存并再次尝试给出了预期的结果。
推荐阅读
- javascript - JavaScript 问题:无法理解为什么我的代码不起作用
- c# - Unity 物体碰撞时什么都不会发生
- python - 如何计算一个月内天数的累积总和?使用 pandas 进行时间序列分析
- excel - 谷歌表格下载为 Excel (XLSX)
- vb.net - 启动 CMD 窗口最小化?
- c++ - 如何删除链表中用户指定的数据节点?
- javascript - RN-fetch-blob 错误 base64 - 仅限 android 问题
- javascript - 如何忽略 Joi 模式中的一个字段?
- python - 如何检查数组是否有 2 列或 3 列?
- javascript - jsPDF 未在 javascript 中定义