https://kotlinlang.org logo
#ktor
Title
# ktor
s

spierce7

07/29/2019, 8:40 PM
If I wanted to intercept all server requests that aren't https, and aren't prefixed with
www
, and redirect to the
<https://www>.
version of my site - what would be the best way to do that?
g

gildor

07/30/2019, 3:06 AM
I would do this on proxy/balancer level
d

darkmoon_uk

07/30/2019, 7:40 AM
There are of course many solutions to this problem; but I found 'Traefik' to be an excellent fit: https://traefik.io/
😃 1
Highly configurable and light HTTP (Reverse) Proxy that will also help you with TLS termination & HTTPS redirects.
s

spierce7

07/30/2019, 8:33 AM
Sure - that's if your project has a proxy / balancer though. I need to do this with ktor.
g

gildor

07/30/2019, 8:37 AM
I wouldn’t say that it’s “the best way”, but what is problem to do that with ktor just by writing own interceptor? Something like this https://ktor.io/advanced/pipeline/route.html#how-to-intercept-preventing-additional-executions
c

cy

07/30/2019, 1:13 PM
39 Views