首页 > 解决方案 > 需要 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;
}
}

谢谢你的帮助!

标签: nginxoracle-apexnginx-reverse-proxy

解决方案


推荐阅读