Skip to main content
deleted 4 characters in body
Source Link
Ajax1234
  • 71.8k
  • 9
  • 68
  • 110

Thank you to everyone who responded. Ultimately, I was able to resolve this issue with two different solutions:

  1. First, I was able to block the offending request by checking the IP in the backend:

    @app.route('/submit_time') def submit_time(): _ip = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr) if _ip == '128.177.108.218': return flask.jsonify({'route':'UNDEFINED-RESULT'.lower()}) return flask.jsonify({"html":'

    Added timestamp

    '})

The above is really more of a temporary solutionhack, as there is no guarantee the target IP will stay the same.

  1. However, I discovered that running on HTTPS also removed the duplicate request. Originally, I was loading my app from the Pythonanywhere dashboard, resulting in http://www.testsite.com. However, once I installed a proper SSL certificate, refreshed the page, and ran the request again, I found that the desired result was produced.

I am awarding the bounty to @computercarguy as his post prompted me to think about the external/network related reasons why my original attempt was failing.

Thank you to everyone who responded. Ultimately, I was able to resolve this issue with two different solutions:

  1. First, I was able to block the offending request by checking the IP in the backend:

    @app.route('/submit_time') def submit_time(): _ip = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr) if _ip == '128.177.108.218': return flask.jsonify({'route':'UNDEFINED-RESULT'.lower()}) return flask.jsonify({"html":'

    Added timestamp

    '})

The above is really more of a temporary solution, as there is no guarantee the target IP will stay the same.

  1. However, I discovered that running on HTTPS also removed the duplicate request. Originally, I was loading my app from the Pythonanywhere dashboard, resulting in http://www.testsite.com. However, once I installed a proper SSL certificate, refreshed the page, and ran the request again, I found that the desired result was produced.

I am awarding the bounty to @computercarguy as his post prompted me to think about the external/network related reasons why my original attempt was failing.

Thank you to everyone who responded. Ultimately, I was able to resolve this issue with two different solutions:

  1. First, I was able to block the offending request by checking the IP in the backend:

    @app.route('/submit_time') def submit_time(): _ip = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr) if _ip == '128.177.108.218': return flask.jsonify({'route':'UNDEFINED-RESULT'.lower()}) return flask.jsonify({"html":'

    Added timestamp

    '})

The above is really more of a temporary hack, as there is no guarantee the target IP will stay the same.

  1. However, I discovered that running on HTTPS also removed the duplicate request. Originally, I was loading my app from the Pythonanywhere dashboard, resulting in http://www.testsite.com. However, once I installed a proper SSL certificate, refreshed the page, and ran the request again, I found that the desired result was produced.

I am awarding the bounty to @computercarguy as his post prompted me to think about the external/network related reasons why my original attempt was failing.

Source Link
Ajax1234
  • 71.8k
  • 9
  • 68
  • 110

Thank you to everyone who responded. Ultimately, I was able to resolve this issue with two different solutions:

  1. First, I was able to block the offending request by checking the IP in the backend:

    @app.route('/submit_time') def submit_time(): _ip = flask.request.environ.get('HTTP_X_REAL_IP', flask.request.remote_addr) if _ip == '128.177.108.218': return flask.jsonify({'route':'UNDEFINED-RESULT'.lower()}) return flask.jsonify({"html":'

    Added timestamp

    '})

The above is really more of a temporary solution, as there is no guarantee the target IP will stay the same.

  1. However, I discovered that running on HTTPS also removed the duplicate request. Originally, I was loading my app from the Pythonanywhere dashboard, resulting in http://www.testsite.com. However, once I installed a proper SSL certificate, refreshed the page, and ran the request again, I found that the desired result was produced.

I am awarding the bounty to @computercarguy as his post prompted me to think about the external/network related reasons why my original attempt was failing.