On Tue, Oct 29, 2019 at 08:41:54PM +0100, Bertalan Zoltán Péter wrote:
> Hello,
> 
> I have a working httpd server behind a relayd reverse proxy.
> 
> Recently I wanted to host some simple text files in a directory that
> contained UTF-8 characters. Unfortunately, I noticed that when opened
> from a browser, say iridium, these documents render with incorrect
> encoding and are illegible. When using curl from my terminal emulator
> however, things worked as expected.
> 
> I suspect this is due to the lack of the 'charset' setting in the
> Content-Type response from my server.
> 
> I suppose I can't set this from httpd's config, but I have to change the
> header with relayd. I found that I could use something like this:
> 
> match response header append "Content-Type" \
>       value "charset=utf-8"
> 
> But this actually seems to create another Content-Type header and does
> not help. I could also just do
> 
> match response header set "Content-Type" value \
>       "text/plain; charset=utf-8"
> 
> But this would make every response classify as text/plain which of
> course is undesirable.
> 
> Is there a proper way to do this? Can I somehow match when text files
> are requested and only then set the header? I tried something with the
> `url` and `path` keywords but after I reloaded relayd it said (ok) but
> did not serve anything with the new config.
> 
> Thanks for your help
> Bertalan
> 
> -- 
> Bertalan Z. Péter <bertalan.pe...@bertalanp99.eu>
> FB9B 34FE 3500 3977 92AE  4809 935C 3BEB 44C1 0F89
> 
> /"\
> \ /    ASCII Ribbon Campaign
>  X   against HTML email & proprietary attachments
> / \    www.asciiribbon.org
> 


Hi,

You can actually do it in httpd.conf.

This will give a syntax error (httpd -n):

        "text/plain; charset=utf-8"     txt

Using quoting will work:

        "text"/"plain; charset=utf-8"   txt

-- 
Kind regards,
Hiltjo

Reply via email to