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

Danish Ansari

08/14/2021, 2:47 PM
I am trying to change from
0.0.0.0
to
0.0.0.0/project_name
but while running I'm getting
java.nio.channels.UnresolvedAddressException
What's the correct way to change host URL?
a

Aleksei Tirman [JB]

08/16/2021, 11:04 AM
You can use
host
method of a
Route
to match requested host and port:
Copy code
routing {
    host("<http://example.com|example.com>") {
        handle {
            call.respondText { "For <http://example.com|example.com>" }
        }
    }
}
You can find more information here https://github.com/ktorio/ktor/issues/1077.
👍 1
d

Danish Ansari

08/16/2021, 11:08 AM
Thank you
3 Views