# Getting proxy\_pass to work with sub\_filter

**URL:** <https://www.ruby-forum.com/t/getting-proxy-pass-to-work-with-sub-filter/221975>\
**Category:** NGINX\
**Created:** [August 7, 2012, 10:34pm UTC](https://www.ruby-forum.com/t/getting-proxy-pass-to-work-with-sub-filter/221975 "2012-08-07T22:34:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 7, 2012, 10:34pm UTC](https://www.ruby-forum.com/t/getting-proxy-pass-to-work-with-sub-filter/221975/1 "2012-08-07T22:34:23Z")

</div>

Hello, I’m trying to have nginx proxy for apache while trying to utilize  
sub\_filter.

My default.conf block with the modules listed above looks like this:

server {  
location / {  
proxy\_pass [http://127.0.0.1:8080](http://127.0.0.1:8080);  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
sub\_filter\_once on;  
sub\_filter ‘’ ‘

filter test12345

’;  
}  
}

With this, I can remove either the proxy\_pass line or the sub\_filter  
line  
and  
the other will work. It seems to only stop working when I try to have  
both  
active at the same time. I did have a look around regarding this issue  
and  
have  
disabled gzip, but to no avail. Does anyone have any insight towards  
this  
issue?

Thank you.

---

<div class="post-metadata">

**Author:** ![Joesep\_Kilsal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/76d3ee/32.png) [@Joesep\_Kilsal](https://www.ruby-forum.com/u/Joesep_Kilsal)\
**Post date:** [August 8, 2012, 12:41pm UTC](https://www.ruby-forum.com/t/getting-proxy-pass-to-work-with-sub-filter/221975/2 "2012-08-08T12:41:20Z")

</div>

Hello!

On Tue, Aug 07, 2012 at 04:33:57PM -0400, Joesep Kilsal wrote:

> ```
> sub_filter_once on;
> 
> ```
> 
> issue?  
> Most often this question is asked when gzip is enabled on a  
> backend host, and hence nginx sess gzipped content which it can’t  
> change. Where you tried to disable gzip? Correct thing to do is  
> to disable gzip on a backend. Alternatively, you may do

proxy\_set\_header Accept-Encoding “”;

on nginx side. This will inform backend that content encodings  
aren’t acceptable and will effectively disable gzip on a backend  
as well.

Maxim D.
