| 
 
 
 | 
| Keep Server Online 
 If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
 
 or
 
 
   
 A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
 
 Thank You! Steffen
 
 Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |  | 
 | 
| | 
| | 
|  Topic: mod_filter 302 body rewrite fail |  |  
| Author |  |  
| ns1 
 
 
 Joined: 15 Mar 2014
 Posts: 1
 Location: UK
 
 | 
|  Posted: Sat 15 Mar '14 21:45    Post subject: mod_filter 302 body rewrite fail |   |  
| 
 |  
| I have changed to mod_filter from AddOutputFilterByType and now cannot rewrite the body content of a 302 page. 
 I can rewrite the Location header using mod_headers, but I need to modify the informational content of the 302 page (usual a href "page has gone here") message as the source app puts internal details on the page.
 
 FilterDeclare FILT
 FilterProvider FILT SUBSTITUTE resp=Content-Type *
 FilterChain FILT
 Substitute "s|http://secret-stuff|https://public-stuff.com|ni"
 
 This works fine with a 200 OK page, but fails on a 302
 
 There are mod_rewrite proxy rules which forward the inbound requests to a downstream server, which is returning the 302 and 200 pages.
 
 If I replace the mod_filter lines with
 
 AddOutputFilterByType SUBSTITUTE text/html
 
 it works fine with a 302 or 200
 
 I've tried every combo of resp, env, req I can think of, with substrings, literals or *, and all sorts of header and env variables, seems to give same results for anything that is in the returned page.
 
 Nothing shows in the log when I do a FilterTrace 1 with the 302, it is like the context for the FilterProvider is wrong.
 
 Have I missed something obvious here?  Surely I can rewrite the content of a 302 page that returns from an upstream server the same as I would a 200 page?
 
 Using Centos 6.4, Apache 2.2.15
 |  |  
| Back to top |  |  
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Tue 29 Apr '14 16:27    Post subject: |   |  
| 
 |  
| I think it can 
 
  	  | Code: |  	  | FilterDeclare FILT FilterProvider FILT SUBSTITUTE resp=Content-Type $text/
 FilterChain FILT
 Substitute "s|http://secret-stuff|https://public-stuff.com|ni"
 | 
 |  |  
| Back to top |  |  
 
 | 
 |  | 
 |  |