【发布时间】:2020-07-03 19:58:37
【问题描述】:
在 nginx 中,我将 /appsearch 映射为指向部署 Elastic AppSearch 的 localhost:3002。当我转到映射的 url http://server/appsearch 时,我看到了部分内容,内容中的 url 指向 http://server/as http://localhost/ 等。即 没有 /appsearch前缀。
当我转到 http://127.0.0.1:3200 时,应用程序重定向到 http://localhost:3002/ent/select 。看起来他们硬编码了“localhost” 一些 nginx-config 可以帮助将网页中的每个资源转换为 http://server/appsearch/ ?
错误的 url 缺少前缀:http://tohulp/as 带前缀的正确网址:http://tohulp/appsearch/as
也许文档中的 url 需要重写? nginx config中怎么做?应用程序不是开源的,所以我无法更改代码,任何解决方案都必须在nginx confing中
server {
listen 80;
server_name TOHQLP;
location /appsearch/ {
rewrite /appsearch(.*) /$1 break;
proxy_pass http://localhost:3002/;
proxy_set_header Accept-Encoding "";
}
===== 应用程序将 127.0.0.1 重定向到本地主机
==== URL 重写导致 Elastic - Enterprise Search 应用程序无法正确呈现 - 也许文档中的各种 url 需要重写?如何在 nginx 配置中做到这一点?
==== 内容来源 http://tohulp/appsearch/as ====
请注意,内容有 localhost:3200,这不会获取资源。如何通过 ngnix 配置绕过/防止/解决这个问题?
【问题讨论】:
标签: nginx