diff --git a/src/runtime/rest/api.org b/src/runtime/rest/api.org index 77ef0bf..4322424 100755 --- a/src/runtime/rest/api.org +++ b/src/runtime/rest/api.org @@ -31,7 +31,7 @@ def get_generic_feedback(): abort(500, "the request does not contain data in json") try: - gateway_ip = str(request.headers.getlist("X-Forwarded-For")[0].rpartition(' ')[-1]) + gateway_ip = str(request.access_route[-1]) data_dict["gateway_ip"] = gateway_ip fb = SystemInterface.add_generic_feedback(data_dict) return jsonify('{"status":"sucess"}') @@ -210,7 +210,7 @@ def get_add_feedback(): abort(400, 'Either lab name or key or version or responses' ' are not passed') else: - gateway_ip = str(request.remote_addr) + gateway_ip = str(request.access_route[-1]) current_app.logger.debug("lab_name = %s, responses=%s, " "version=%s, key=%s, " %(data_dict['lab_name'], data_dict['responses'], @@ -644,7 +644,7 @@ class TestGetFeedbackDump(TestCase): @api.route('/get_gateway_ip', methods=['GET']) def get_gateway_ip(): try: - gateway_ip = str(request.headers.getlist("X-Forwarded-For")[0].rpartition(' ')[-1]) + gateway_ip = str(request.access_route[-1]) return jsonify({'gateway_ip': gateway_ip}) except Exception as e: return "Error in getting the gateway_ip"