permanent redirect some-portal.com/hns/[domain] to [domain].hns.some-portal.com
This commit is contained in:
parent
85dd22a72e
commit
59347ba909
|
@ -137,15 +137,13 @@ location /abuse/report {
|
||||||
location /hns {
|
location /hns {
|
||||||
include /etc/nginx/conf.d/include/cors;
|
include /etc/nginx/conf.d/include/cors;
|
||||||
|
|
||||||
# match the request_uri and extract the hns domain and anything that is passed in the uri after it
|
rewrite_by_lua_block {
|
||||||
# example: /hns/something/foo/bar matches:
|
local hns_domain = string.match(ngx.var.uri, "/hns/([^/?]+)")
|
||||||
# > hns_domain: something
|
local path = string.match(ngx.var.uri, "/hns/[^/?]+(.*)")
|
||||||
# > path: /foo/bar/
|
local hns_subdomain_url = ngx.var.scheme .. "://" .. hns_domain .. ".hns." .. ngx.var.skynet_portal_domain .. path .. ngx.var.is_args .. ngx.var.args
|
||||||
set_by_lua_block $hns_domain { return string.match(ngx.var.uri, "/hns/([^/?]+)") }
|
|
||||||
set_by_lua_block $path { return string.match(ngx.var.uri, "/hns/[^/?]+(.*)") }
|
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
return ngx.redirect(hns_subdomain_url, ngx.HTTP_MOVED_PERMANENTLY)
|
||||||
include /etc/nginx/conf.d/include/location-hns;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
location /hnsres {
|
location /hnsres {
|
||||||
|
|
Reference in New Issue