简体   繁体   English

Apache反向代理-重写并替换返回的答案

[英]Apache reverse proxy - rewrite and Substitute returning answer

We have reverse proxy server which use rewrite rule to redirect one address to another. 我们有反向代理服务器,它使用重写规则将一个地址重定向到另一个地址。

When redirection is working, we get back an answer from that site (google) as a txt page. 当重定向有效时,我们从该站点(google)处以txt页面的形式获取答案。

Now, we wish to Substitute few words in that page and direct it to the source server that asked for it. 现在,我们希望替换该页面中的几个词,并将其定向到要求它的源服务器。

Our configuration looks like this: 我们的配置如下所示:

ProxyRequests Off
RewriteEngine on

RewriteRule ^/books\.google\.com(.*) https://books.google.com/$1
Substitute "s/thumbnail_url/test/ni"

We do get the page back from google, but Substitute of words in the page is not working. 我们的确从google获得了该页面,但无法用该页面中的单词代替。

Hoping someone can answer it. 希望有人能回答。

Thanks 谢谢

Found the way to do so, by adding the following lines: 通过添加以下行找到了这样做的方法:

SSLProxyEngine On RequestHeader set Front-End-Https "On" SSLProxyEngine On RequestHeader将前端HTTPs设置为“开”

Substitute "s/thumbnail_url/test/ni" [P] 替代“ s / thumbnail_url / test / ni” [P]

Cause [P] will made the all query to work with https (as rewrite rule defined) and two first lines support SSL on apache proxy. 原因[P]将使all查询与https(定义的重写规则)一起使用,并且第一行中的两行支持apache代理上的SSL。

Lavi 拉维

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM