gpt4 book ai didi

linux - 无法重定向到 apache 中的其他 url

转载 作者:太空宇宙 更新时间:2023-11-04 12:07:48 25 4
gpt4 key购买 nike

我有两台 Redhat Linux 服务器,分别是“原始”和“演示”。两者都运行着 apache。在原始服务器上,我想将其重定向到 http://original.com/abc 的页面上有一个链接“http://demo.com ”。

我所做的是-

在原始服务器上打开 httpd.conf 并添加以下行并重新启动 apache 服务:

ProxyPass         /abc  http://demo.com/
ProxyPassReverse /abc http://demo.com/

但是当我尝试访问 http://original.com/abc 时,它会将我重定向到原始服务器,即在 http://original.com 上(而不是在 http://demo.com 上)

我尝试在各种网站上找到解决方案,但无法找出问题所在。

编辑:curl -v http://original.com/abc 的输出:

curl -v http://original.com/abc
* About to connect() to original.com port 80 (#0)
* Trying 10.100.100.100...
* Connected to original.com (10.100.100.100) port 80 (#0)
> GET /demo HTTP/1.1
> User-Agent: curl/7.29.0
> Host: original.com
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Tue, 24 Apr 2018 06:30:23 GMT
< Server: Apache-Coyote/1.1
< X-Frame-Options: SAMEORIGIN
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Location: login.action
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Set-Cookie: JSESSIONID=0BAA246C7F2505D2F5A0335CB0542CAA; Path=/; HttpOnly
<
* Connection #0 to host original.com left intact

curl -v http://demo.com/ 的输出:

#curl -v http://demo.com
* About to connect() to 10.100.100.101 port 80 (#0)
* Trying 10.100.100.101...
* Connected to 10.100.100.101 (10.100.100.101) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: demo.com
> Accept: */*
>
< HTTP/1.1 302 Found
< Server: Apache-Coyote/1.1
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Set-Cookie: JSESSIONID=FED19458459131F456D638EC57278C2A; Path=/; HttpOnly
< Location: login.action
< Content-Type: text/html
< Content-Length: 0
< Date: Tue, 24 Apr 2018 06:31:47 GMT
<
* Connection #0 to host demo.com left intact

最佳答案

ProxyPass 语句的文本顺序是相关的。第一个匹配的条目停止进一步匹配。

ProxyPass         /     http://some.tomcat:8080/
ProxyPassReverse / http://some.tomcat:8080/
...
ProxyPass /abc http://demo.com/
ProxyPassReverse /abc http://demo.com/

在这里,demo.com 什么也得不到。 some.tomcat 将被同时提供 //abc

关于linux - 无法重定向到 apache 中的其他 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49994738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com