# [Solved] apache2 mod_proxy_html simple setup for reddit.com

## reddwarf

Hello folks,

I'm having trouble setting up a proxy for reddit.com.

Setup:

apache 2.2.21-r1

mod_proxy

mod_proxy_http

mod_proxy_html 3.0.1

Basically, what I manage to get is a proxy mirror of reddit.com but no links are rewritten

therefore the proxy is only effective for the front page.

27_mod_proxy_html.conf

```
ProxyHTMLLogVerbose On

ProxyRequests Off

ProxyPass /reddit/ http://www.reddit.com/

<Location /reddit/>

 ProxyPassReverse /reddit/

 ProxyHTMLURLMap http://www.reddit.com/ /reddit/

 ProxyHTMLURLMap / /reddit/

</Location>

```

anything else I'd be missing ? so that

http://www.reddit.com/r/worldnews/  would be rewritten into http://mydomain/reddit/r/worldnews

Thanks =)

[Solved EDIT]

Indeed the problem was with the SetOutputFilter directive

At first, SetOutputFilter proxy-html was giving me invalid content warnings in browsers which led me to read

http://wiki.uniformserver.com/index.php/Reverse_Proxy_Server_2:_mod_proxy_html_2

When configured only with SetOutputFilter proxy-html, mod_proxy_html expects a clear HTML input, yet its input is gzip deflated.

The solution is to set SetOutputFilter INFLATE;proxy-html;DEFLATE

which would decompress the content from reddit.com, process it using mod_proxy_html and recompress it back before delivering it to the proxy client.Last edited by reddwarf on Fri Jan 13, 2012 8:54 am; edited 1 time in total

----------

## tgR10

i got just 2 mins, so i found my old post (it's in polish but configuration files should give you enough info) take a look at https://forums.gentoo.org/viewtopic-t-824114-highlight-.html

when i'll be back, i'll try to sort this out in english.

----------

## reddwarf

 *tgR10 wrote:*   

> i got just 2 mins, so i found my old post (it's in polish but configuration files should give you enough info) take a look at https://forums.gentoo.org/viewtopic-t-824114-highlight-.html
> 
> when i'll be back, i'll try to sort this out in english.

 

Thanks for your input,

I do understand bits and pieces of Polish and that thread seems to relate to only proxy/proxy_http

I got those working for both

prefix.mydomain/  ==> reddit.com AND

mydomain/reddit/ == > reddit.com

but, as advertised, mod_proxy and mod_proxy_http only changes the headers.

the content (<body>) delivered through the proxy remains the same as on the original reddit.com website.

this is where mod_proxy_html should parse the content and replace all occurences of reddit.com by mydomain/reddit/

but it doesn't do it.. it does load successfully .. meaning "-D PROXY_HTML" works fine

it just looks plain disabled

also, gentoo portage only has version 3.0.0 and 3.0.1 of proxy_html whereas the latest version is 3.1.2

which does simplify the configuration with a variable ProxyHTMLEnable On (only available in 3.1.x)

Anyway, still looking for someone who managed to get mod_proxy_html 3.0.x to work in a simple setup  :Smile: 

----------

