Skip to content

Commit

Permalink
support nginx with access path (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
metzm authored Sep 8, 2022
1 parent f4644a4 commit b19dee3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/openeo_grass_gis_driver/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,7 @@


def replace_links_in_capabilities():
host_url = request.host_url.rstrip('/')
split_url = host_url.split('/')
if host_url.startswith('http'):
new_url = "%s//%s" % (split_url[0], split_url[2])
else:
new_url = split_url[0]
new_url = request.root_url.rstrip('/')

for i in CAPABILITIES['links']:
sample_url = i['href']
Expand All @@ -226,7 +221,7 @@ def replace_links_in_capabilities():
class Capabilities(Resource):

def get(self, ):
# links need to be replaced here because host_url
# links need to be replaced here because root_url
# is only available during a request
CAPABILITIES = replace_links_in_capabilities()
return make_response(jsonify(CAPABILITIES), 200)
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_grass_gis_driver/well_known.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self):

def get(self):

url = '%s%s/' % (request.host_url.strip('/'), URL_PREFIX)
url = '%s%s/' % (request.root_url.strip('/'), URL_PREFIX)

version_list = list()
version_list.append({"url": url,
Expand Down

0 comments on commit b19dee3

Please sign in to comment.