2011-03-08 13 views

risposta

4

Sto usando mod_filter per sostituire invece di sgonfiare, ma l'idea è la stessa. Questo è ciò che ha funzionato per me (sto facendo proxy inverso e riscrittura degli URL e link):

LoadModule substitute_module modules/mod_substitute.so 
LoadModule filter_module modules/mod_filter.so 
FilterDeclare MYFILTER 
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $text/ 
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $/xml 
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $/json 
FilterProvider MYFILTER SUBSTITUTE resp=Content-Type $/javascript 
<Location /sial/> 
    ProxyPass  http://localhost:8300/ 
    ProxyPassReverse http://localhost:8300/ 
    ProxyPassReverseCookiePath//sial/ 
    FilterChain MYFILTER 
    Substitute "s|/tea_sial_v2|/sial/tea_sial_v2|inq" 
</Location> 
14

AddOutputFilterByType avuto gravi limitazioni in httpd-2.2 così è stato segnato lì disapprovato. Ma in httpd-2.4 questa direttiva è stata spostata su filter_module, corretta e non deprecata.

in Apache 2.2 si dovrebbe invece consentire filter_module e deflate_module ed impiego:

# Declare a "gzip" filter, it should run after all internal filters like PHP or SSI 
FilterDeclare gzip CONTENT_SET 

# "gzip" filter can change "Content-Length", can not be used with range requests 
FilterProtocol gzip change=yes;byteranges=no 

# Enable "gzip" filter if "Content-Type" contains "text/html", "text/css" etc. 
FilterProvider gzip DEFLATE resp=Content-Type $text/html 
FilterProvider gzip DEFLATE resp=Content-Type $text/css 
FilterProvider gzip DEFLATE resp=Content-Type $text/javascript 
FilterProvider gzip DEFLATE resp=Content-Type $application/javascript 
FilterProvider gzip DEFLATE resp=Content-Type $application/x-javascript 

# Add "gzip" filter to the chain of filters 
FilterChain gzip 

deflate_module servirebbe solo contenuti compressi per i browser che dichiarano il supporto per la codifica in gzip richiesta di intestazione.

+1

Questo mi ha aiutato bigtime. Solo un avviso su FilterProvider: https://github.com/h5bp/html5-boilerplate/issues/1012 – cgp

+0

In Centos filter_module non è abilitato di default. Deve essere privo di commenti. –

+0

Ciò ha provocato l'assenza casuale di ETags dalle risposte gzip. – Timothy003

2

Diventa obsoleto in Apache 2.3.7, perché è stato spostato/integrato in mod_filter. Allora, che cosa ho in:

Invece di:

<IfModule mod_deflate.c> 
    AddOutputFilterByType DEFLATE text/css 
</IfModule> 

utilizzando:

<IfModule mod_filter.c> 
    AddOutputFilterByType DEFLATE text/css 
</IfModule> 
Problemi correlati