7

I have a mod_substitute as below, which works perfectly fine in curl but not on browser. Also, it works on all pages except one page.

I would like to know what would cause mod_substitute not work on browser? how to debug and fix this issue?

2
  • maybe browser gives gzip compression which maybe makes it hard for for substitute to work, try RequestHeader unset Accept-Encoding
    – Petter H
    Commented Apr 11, 2017 at 14:16
  • Using SetEnv no-gzip 1 solves the problem.Thanks a lot.
    – Hema
    Commented Apr 12, 2017 at 7:06

2 Answers 2

16

To troubleshoot such issues, it is a good idea to compare the headers in the browser with the ones in curl (-i, --include flag will show headers, and -H flag can add them), and from the browser add one at a time to curl command until the problem reproduces.

I read in the comments section of mod_substitute docs page that describes symptoms like the ones you described, with mod_substitute sometimes not working as expected:

It turned out it was the order of our filter chain. DEFLATE was running before SUBSTITUTE. For small files, DEFLATE was not doing anything, so it worked. On some internal proxy stuff that did not send an Accept-Encoding header it was working. But, other times it did not. In the end, this worked best:

AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE text/html text/plain text/xml

Another option is to unset Accept-Encoding header for the target resource where mod_substitute is supposed to do it's substitutions.

RequestHeader unset Accept-Encoding

It's (arguably) better to use the other trick instead, so that you can reap the benefits both of mod_deflate and mod_substitute though.

1
  • I am not using deflate module, so that should not affect my substitute. Also, adding "RequestHeader unset Accept-Encoding" disables all javascript on the page from working, and many links on page stops working. Do you have any other clues to solve this?
    – Hema
    Commented Apr 13, 2017 at 7:10
1

Disabling gzip compression solves the issue. Add the below lines to httpd.conf SetEnv no-gzip 1 solves the problem

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .