@robj Most domain registrars will let you configure canonical redirects like this at the DNS levels you’re not needlessly sending the request to a web application, booting that web application, and that web application then having to return a redirect response.
@martinbean Yes - it's another moving part though. Feels like something you should be able to do in Vapor, I mean they redirect www.domain.tld to domain.tld - that's a config in nginx or something, right?
@robj But again, you’re sending a request to a web framework, that then has to boot a process and the entire Laravel framework, just to redirect; when you redirect before any of that by doing the redirect at the DNS level.
@martinbean Yup, I didn't suggest otherwise, I said it was another moving part - Vapor already redirects www to root and that behaviour is configurable, so, the idea that it could do it for different tld's etc in line with its current capability isn't ridiculous.
@martinbean A full HTTP redirect with relative path and query parameters preserved cannot be done at the DNS level. Cloud domain name providers that allow these services run an Apache/NGINX server in the background when you enable this service.
Is there a way to have this cleanly set up using Vapor? I have 4-5 Production domains that need to be redirected to a single master domain.