Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kreynoldsf5 committed May 2, 2024
1 parent 5cc19b4 commit eadcb31
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions labapp/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,21 @@ def manip3():
return jsonify(status='success', data=data)
except (LabException, requests.RequestException, ValueError) as e:
return jsonify(status='fail', error=str(e))

@app.route('/_port1')
def port1():
"""Azure LB test"""
try:
s = requests.Session()
s.headers.update({"User-Agent": "MCN-Lab-Runner/1.0"})
ns = eph_ns()
if not ns:
raise LabException("Ephemeral NS not set")
url = f"https://{ns}.{app.config['base_url']}/"
data = cloudapp_fetch(s, url, 7, 'info', {"method": "GET", "path": "/"})
return jsonify(status='success', data=data)
except (LabException, requests.RequestException, ValueError) as e:
return jsonify(status='fail', error=str(e))


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion labapp/app/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def headers_cleaner(headers):
Remove headers that contain specific substrings.
Use this to make responses look nicer.
"""
unwanted_substrings = ['x-envoy', 'cloudfront', 'x-k8se', 'x-amz', 'z-amzn', 'via', 'x-arr-ssl']
unwanted_substrings = ['x-envoy', 'cloudfront', 'x-k8se', 'x-amz', 'z-amzn', 'via', 'x-arr-ssl', 'x-ms-containerapp']
filtered_headers = {
key: value for key, value in headers.items()
if not any(substring in key.lower() for substring in unwanted_substrings)
Expand Down

0 comments on commit eadcb31

Please sign in to comment.