nginx - Url 参数在 NGINX 子文件夹重定向中不起作用
问题描述
当我在本地(127.0.0.1)使用网络服务时,带参数的端点正常工作,网络服务返回正常内容。
localmachine 中的 URL 为:http://localhost:8888/servico/search/findByEmpresaId?empresaId=1
此查询由 Web 服务返回正确。
要将 https 添加到 webervice,我使用 NGINX 并重定向到子文件夹。新网址是:
https://systemapp/servico/search/findByEmpresaId?empresaId=1
但是在 NGIX 服务器上,将不带参数的 url 发送到 webservice
http://localhost:8888/search/findByEmpresaId
我使用的 .conf 是:
location ~/webservice(.*)$ {
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
proxy_pass http://localhost:8888$1;
}
使用此重定向,端点 https://systemapp/webservice/empresa?test=1;teste2=2 仅在使用 https://systemapp/webservice/empresa/1/2 时有效
解决方案
感谢@RichardSmith
location ~/webservice(.*)$ {
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
proxy_pass http://localhost:8888$1$is_args$args;
}
推荐阅读
- android - 过滤recyclerview的项目这么慢
- python - 在 Python 中查找变量的先前值
- amazon-web-services - AWS cognito 服务的多租户支持
- flask - 什么会导致 Flask-WTForms 为每个字段返回 None ?
- sql - REGEXP 模式匹配
- documentation - 如何创建仅记录通过 index.ts 公开的对象的 Typedoc?
- php - 循环函数(Foreach)Laravel中的处理程序空值
- python - 如何在 PyQt 中通过文本为 QTableView 创建过滤器
- java - Weblogic LogicalConnection 无法强制转换为 oracle.jdbc.OracleConnection
- ios - 在视图出现之前未设置 UIButton 标题