nginx - 需要 Nginx 重写规则
问题描述
我有一个网站https://example.com/ords/。
浏览到该站点时,会自动添加以下参数:
https://example.com/ords/f?p=4550:1:4555898965939 :::::
我的网站托管在 nginx 网络服务器(反向代理)和同一主机上的 tomcat 网络服务器上(监听 localhost,8080)。
我的目标是在 URL 中隐藏参数列表(f?p=4550:1:4555898965939:::::)。
我所有尝试配置 nginx 重写规则,以便在不成功的地方存档我的目标。
这是我最新的配置文件:
server {
listen 10.1.2.3:80; #IP changed
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen 10.1.2.3:443 ssl http2; #IP changed
server_name example.com;
root ords;
ssl_certificate "/etc/ssl/example.com.crt";
ssl_certificate_key "/etc/ssl/example.com.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Origin "";
try_files $uri $uri/ =404;
}
location /i {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Origin "";
}
location /ords {
proxy_pass http://127.0.0.1:8080;
rewrite (f\?p=.*)$ https://example.com/ords last;
}
}
谢谢你的帮助!
解决方案
推荐阅读
- java - Maven 测试没有运行黄瓜测试
- ios - 如何快速替换特定位置的字母
- javascript - SendEmail 函数:由于空白行中的公式而出错
- r - 计算自第一个事件 R 以来经过的天数
- sql - 如何在找到两个连续行之间的 MAX() 差异之前对表进行排序
- puppeteer - Puppeteer:无头 Chromium 中的屏幕截图导致块状渐变
- java - JPackage-我应该将资源文件夹放在我的 Windows 应用程序映像的哪里?
- json - 如何在 Swift 4 中解码这个 JSON
- java - Flutter 中的相机插件中的自拍相机崩溃
- mysql - 通过 JDBC 语句执行 DDL “drop table Player if exists”时出错