ReverseProxy und ReplacePattern

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 2
Joined: 16 Jun 2014, 06:51

ReverseProxy und ReplacePattern

16 Jun 2014, 07:06

Hi

I have no luck to get 'ReplacePattern' with the 'ProxyPass' working together.
Env is my local machine WIN7 with IIS8 Express and APE 3.1.0.135.

My httpd.conf:

Code: Select all
Loglevel debug
Options +StopOnError +ShowErrorInResponse
LoadModule env_module         modules/mod_env.so
LoadModule proxy_module         modules/mod_proxy.so
LoadModule replace_module      modules/mod_replace.so

ReplaceFilterDefine revproxy CaseIgnore intype=text/html
ReplacePattern revproxy "http:\/\/www\.swisscom\.ch\/" "/"
SetEnv mod_replace revproxy

ProxyPass / http://www.swisscom.ch/
ProxyPassReverse / http://www.swisscom.ch/


The reverse proxy is working fine, but it does not replace anything.
It should replace all links from 'http://www.swisscom.ch/' to '/'.

I tried to remove the 'intype=text/html' flag or with a simple replace like
ReplacePattern revproxy "a" "b"

But nothing gets replaced.

Thanks for help!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: ReverseProxy und ReplacePattern

17 Jun 2014, 09:32

Hello,

Here're some things to consider:
1. In the line
ReplaceFilterDefine revproxy CaseIgnore intype=text/html

you'd need to specify the type of content you can actually see in the browser, e.g. "text/html; charset=UTF-8"
2. Sometimes the response fro back-end is zipped.
In any case it'd be beneficial to see the error.log, after enabling the logs.

Regards

User avatar
Posts: 16
Joined: 20 Nov 2013, 13:10

Re: ReverseProxy und ReplacePattern

21 Jun 2014, 16:37

Hi!

Did you try it without the backslashes?

I think this should work:
ReplacePattern revproxy "http://www.swisscom.ch/" "/"

cheers
swobi

User avatar
Posts: 2
Joined: 16 Jun 2014, 06:51

Re: ReverseProxy und ReplacePattern

08 Jul 2014, 09:05

Hi

Thank you for your answers.

I try to add the "text/html; charset=UTF-8" but it didn't help.
Also tried to remove the backslashes in the replace pattern, but it does not work.

Here is a export of the error.log when accessing a page witch should be replaced

Code: Select all
[2014-07-08 13:45:49.322] [LicenseManager] Credentials for Swisscom (Schweiz) AG are valid
[2014-07-08 13:45:55.570] [proxy] (debug) [/de/privatkunden/swisscom-tv/sender.html] request to http://www.swisscom.ch/de/privatkunden/swisscom-tv/sender.html
... lot of requests to css,js,images...


Yes, the backend server response is gzipped.
How can i remove the 'gzip' in the 'Accept-Encoding' header before the request is send to the backend server?

Thanks for help.

Edit:

Ok i figure it out, after i remove the gzip in the header, it works now.
Here the config line:

Code: Select all
RequestHeaderPattern Accept-Encoding "gzip" " "


:) cheers

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 8 guests