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

add options feature on apps package and add a SetHost option to force host on multiple subdomains that should mean the same exact application, so any handler should run based on the same Host field

This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-19 05:32:21 +03:00
parent bdb94bbae2
commit dddfeb9ca9
4 changed files with 141 additions and 19 deletions

View File

@@ -119,13 +119,12 @@ func newHostRedirectApp(targetHost string, code int) *iris.Application {
// carefully checks if the expression already matched the "redirectTo"
// to avoid the redirect loops at all.
// iris: switch: hosts redirect: loop detected between expression: "^my.*$" and target host: "mydomain.com"
http.Error(w, http.StatusText(iris.StatusLoopDetected), iris.StatusLoopDetected)
http.Error(w, iris.StatusText(iris.StatusTooManyRequests), iris.StatusTooManyRequests)
return
}
r.Host = targetHost
r.URL.Host = targetHost
// r.URL.User = nil
http.Redirect(w, r, r.URL.String(), code)
})