Hi!
I need to implement multilang sub domains, e.g en.exmaple.com, de.example.com. So no matter what is a language of user - if he goes to de.exmaple.com - the language is DE.
My current backend proxy detects language by Accept-Language header. So how can I change user request Accept-Language header, depending on subdomain?
en.example.com www.en.example.com {
tls [email protected]
gzip
proxy / ip:port ip2:port {
policy round_robin
...
transparent
}
<change user header for en>
}
de.example.com www.de.example.com {
tls [email protected]
gzip
proxy / ip:port ip2:port {
policy round_robin
...
transparent
}
<change user header for de>
}
P.S. is there way to create same proxy for both subdomains without duplicating most of settings?
P.P.S caddy 1.03
Hi! Thanks for trying Caddy!
Please ask your usage questions on the Caddy community forums. We prefer to keep the GitHub issue board for bugs and feature requests.
That said, what you're looking for it the {labelN} placeholders. In your case you would use {label2} to get the language in your subdomain.
We highly recommend you try Caddy v2 instead though, as Caddy v1 is no longer actively supported! In Caddy v2 the same concept applies, you would use the {http.request.host.labels.*} placeholder instead.
Most helpful comment
Hi! Thanks for trying Caddy!
Please ask your usage questions on the Caddy community forums. We prefer to keep the GitHub issue board for bugs and feature requests.
That said, what you're looking for it the
{labelN}placeholders. In your case you would use{label2}to get the language in your subdomain.We highly recommend you try Caddy v2 instead though, as Caddy v1 is no longer actively supported! In Caddy v2 the same concept applies, you would use the
{http.request.host.labels.*}placeholder instead.