Skip to content

Commit b19dee3

Browse files
authored
support nginx with access path (#151)
1 parent f4644a4 commit b19dee3

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/openeo_grass_gis_driver/capabilities.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,7 @@
205205

206206

207207
def replace_links_in_capabilities():
208-
host_url = request.host_url.rstrip('/')
209-
split_url = host_url.split('/')
210-
if host_url.startswith('http'):
211-
new_url = "%s//%s" % (split_url[0], split_url[2])
212-
else:
213-
new_url = split_url[0]
208+
new_url = request.root_url.rstrip('/')
214209

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

228223
def get(self, ):
229-
# links need to be replaced here because host_url
224+
# links need to be replaced here because root_url
230225
# is only available during a request
231226
CAPABILITIES = replace_links_in_capabilities()
232227
return make_response(jsonify(CAPABILITIES), 200)

src/openeo_grass_gis_driver/well_known.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self):
2222

2323
def get(self):
2424

25-
url = '%s%s/' % (request.host_url.strip('/'), URL_PREFIX)
25+
url = '%s%s/' % (request.root_url.strip('/'), URL_PREFIX)
2626

2727
version_list = list()
2828
version_list.append({"url": url,

0 commit comments

Comments
 (0)