AddOutputFilterByType устарела в Apache.
В документации говорится, что те же функции доступны с помощью mod_filter.
В настоящее время я использую
AddOutputFilterByType DEFLATE text/html
Что эквивалентно с помощью mod_filter?
AddOutputFilterByType устарела в Apache.
В документации говорится, что те же функции доступны с помощью mod_filter.
В настоящее время я использую
AddOutputFilterByType DEFLATE text/html
Что эквивалентно с помощью mod_filter?
AddOutputFilterByType
имел серьезные ограничения в httpd-2.2
, поэтому он был отмечен как устаревший. Но в httpd-2.4
эта директива была перенесена на filter_module
, исправлена и не устарела.
В apache 2.2 вместо этого вы должны включить filter_module
и deflate_module
и использовать:
# 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
будет обслуживать только сжатый контент для браузеров, объявляющих поддержку кодировки gzip
в заголовке запроса.
Я использую mod_filter
для замены вместо дефлятирования, но идея та же. Вот что сработало для меня (я делаю обратный прокси и переписываю URL и ссылки):
LoadModule substitute_module modules/mod_substitute.so
LoadModule filter_module modules/mod_filter.so
FilterDeclare MYFILTER
# syntax changed in Apache2.4 (see also https://httpd.apache.org/docs/current/mod/mod_filter.html)
FilterProvider MYFILTER SUBSTITUTE "%{Content_Type} = 'text/html'"
FilterProvider MYFILTER SUBSTITUTE "%{Content_Type} = 'text/xml'"
FilterProvider MYFILTER SUBSTITUTE "%{Content_Type} = 'application/javascript'"
FilterProvider MYFILTER SUBSTITUTE "%{Content_Type} = 'application/json'"
<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>
Это стало устаревшим в Apache 2.3.7, потому что он был перемещен/интегрирован в mod_filter
. Итак, что я получил в:
Вместо:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css
с помощью:
<IfModule mod_filter.c>
...