java - NGINX URI 与周期代理通行证问题
问题描述
所以我们有一个设置,其中 nginx 是我们的反向代理,它在多个位置使用 proxy_pass 到 apache tomcat。我们遇到的问题是这样的:
- 如果 URI 包含一个点/句点作为尾随值(例如http://example.com/sub/john-doe.),则不会正确转发到 tomcat。
- 根据 tomcat 中的访问日志,“句点”已从 URI 路径中排除/删除。
(http://example.com/sub/john-doe。)。--> ( http://192.168.1.10:8080/sub/john-doe )
通过本地访问( http://192.168.1.10:8080/sub/john-doe. )直接测试 tomcat工作正常。“句号”没有被删除。
nginx 中的正确配置是什么?
TIA
- nginx 1.19(Windows)
常用配置
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
add_header X-XSS-Protection "1; mode=block";
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 4000M;
location /sub {
proxy_pass http://<ip>:8080/sub
}
解决方案
推荐阅读
- javascript - React 本机访问 reload 方法 dev-tools
- javascript - 萤火虫怎么了?有没有好的替代品?
- dialogflow-es - 是否可以在前端(Angular)中使用 dialogflow-nodejs-client-v2?
- java - 服务已经在运行,但它不应该在使用后台服务代码的位置
- mysql - 如何以最佳方式同时搜索文本和整数数据类型?
- python - Python asyncio (aiohttp, aiofiles)
- r - 为什么 as.matrix 在 R 中运行文本挖掘时会导致内存过载
- firebase - Firestore 提要/时间线建模
- node.js - 将猫鼬连接导出到我的 model.js 文件
- coldfusion - 基于数组模数创建四种结构的coldfusion不那么繁琐的方法