如何更改 content-type 但保留 Apache2 上的字符集?
How to change content-type but keep charset on Apache2?
我在 Ubuntu 上有一个 Apache2 服务器作为代理服务器。我想将 content-type
对客户端的响应更改为另一个,但它也会删除 charset
。
# /etc/apache2/sites-available/000-default.conf
Header set Content-Type "text/html" "expr=%{resp:Content-Type} =~ m|text/abcdefgh|"
使用此设置,当它看到 content-type 为 text/abcdefgh
或 text/abcdefgh; charset=utf-8
或 text/abcdefgh; charset=shift_jis
的 header 时,它将变为 text/html
没有 charset
- 有什么方法可以将
content-type
的一部分更改为 Header set
或 others
吗?
- 在哪里可以找到这个模式的含义?
非常感谢!
您是否尝试使用 edit
而不是 set
?
Header edit Content-Type "text/abcdefgh" "text/html"
它应该只用 text/html
替换 text/abcdefgh
但保留字符集原样
我在 Ubuntu 上有一个 Apache2 服务器作为代理服务器。我想将 content-type
对客户端的响应更改为另一个,但它也会删除 charset
。
# /etc/apache2/sites-available/000-default.conf
Header set Content-Type "text/html" "expr=%{resp:Content-Type} =~ m|text/abcdefgh|"
使用此设置,当它看到 content-type 为 text/abcdefgh
或 text/abcdefgh; charset=utf-8
或 text/abcdefgh; charset=shift_jis
的 header 时,它将变为 text/html
没有 charset
- 有什么方法可以将
content-type
的一部分更改为Header set
或others
吗? - 在哪里可以找到这个模式的含义?
非常感谢!
您是否尝试使用 edit
而不是 set
?
Header edit Content-Type "text/abcdefgh" "text/html"
它应该只用 text/html
替换 text/abcdefgh
但保留字符集原样