1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

add internal subdomain redirect handler

TODO more things
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-16 20:16:49 +03:00
parent f8ac760f69
commit a61f743fa8
6 changed files with 142 additions and 49 deletions

View File

@@ -26,5 +26,5 @@
127.0.0.1 username3.mydomain.com
127.0.0.1 username4.mydomain.com
127.0.0.1 username5.mydomain.com
127.0.0.1 en-us.test.mydomain.com
#-END iris-

View File

@@ -54,6 +54,7 @@ func main() {
// http://username1.mydomain.com:8080
// http://username2.mydomain.com:8080/something
// http://username3.mydomain.com:8080/something/yourname
// http://en-us.test.mydomain.com:8080/something/42
app.Listen("mydomain.com:8080") // for beginners: look ../hosts file
}
@@ -66,6 +67,6 @@ func dynamicSubdomainHandler(ctx iris.Context) {
func dynamicSubdomainHandlerWithParam(ctx iris.Context) {
username := ctx.Subdomain()
ctx.Writef("Hello from dynamic subdomain path: %s, here you can handle the route for dynamic subdomains, handle the user: %s", ctx.Path(), username)
ctx.Writef("Hello from dynamic (full) subdomain: %s and path: %s, here you can handle the route for dynamic subdomains, handle the user: %s", ctx.SubdomainFull(), ctx.Path(), username)
ctx.Writef("The paramfirst is: %s", ctx.Params().Get("paramfirst"))
}