Now we have:
{
"id": "example.net",
"frontends": [
{
"kind": "hostname",
"hostname": "example.net",
"path_prefix": "/"
}
],
"backend": "..."
}
We want to be able to redirect www. => naked domain. Options:
- Without writing any code, we already have a redirect backend, but our design assumes one backend per app, so we'd have to write separate app for the redirect. => not good
- Support multiple backends per app (override with redirect backend on www. hostname). This is the only use case that requires it => not good
- Just have a flag on the frontend that it should redirect to naked domain, and have Edgerouter handle that internally somehow. That feels a bit dirty though, too.
The last idea looks something like:
{
"id": "example.net",
"frontends": [
{
"kind": "hostname",
"hostname": "example.net",
"path_prefix": "/"
},
{
"kind": "hostname",
"hostname": "www.example.net",
"path_prefix": "/",
"redirect_to_naked_domain": true
}
],
"backend": "..."
}
Currently we're using Cloudflare page rules for this, but I don't like it because I like the idea of turning Cloudflare off and not having behavioural changes