Merge pull request #1998 from jberry-suse/obs_operator-handle-multilevel-domains
obs_operator: handle multi-level origin domains.
This commit is contained in:
commit
fbd1bbd4e2
@ -135,7 +135,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Remove first subdomain and replace with api subdomain.
|
# Remove first subdomain and replace with api subdomain.
|
||||||
domain_parent = '.'.join(domain.split('.')[1:])
|
domain_parent = '.'.join(domain.split('.')[-2:])
|
||||||
return 'https://api.{}'.format(domain_parent)
|
return 'https://api.{}'.format(domain_parent)
|
||||||
|
|
||||||
def origin_domain_get(self):
|
def origin_domain_get(self):
|
||||||
@ -144,7 +144,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|||||||
# Strip port if present.
|
# Strip port if present.
|
||||||
domain = urlparse(origin).netloc.split(':', 2)[0]
|
domain = urlparse(origin).netloc.split(':', 2)[0]
|
||||||
if '.' in domain:
|
if '.' in domain:
|
||||||
return '.'.join(domain.split('.')[1:])
|
return '.'.join(domain.split('.')[-2:])
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user