2

I am working on a Flask web application, and encountering an issue concerning duplicate HTTP requests.

Every time a request is made, it is sent twice (for GET requests and POST requests as well), as can be seen on the screenshot below. I am running the application in production environment and with debug mode being "off".

How could I find out why the requests are being sent twice ?

EDIT:

The view functions are indeed being called twice every time a request is made. Any ideas ?

from flask import render_template


@product.route('/', methods=['GET', 'POST'])
@login_required
def index():
    print('Request to index.')
    products = Product.query.all()
    return render_template('product/index.html', products=products)

Duplicate HTTP GET request

4
  • Are they sent twice or logged twice? Commented Feb 15, 2020 at 9:28
  • Hello Klaus, thanks for your feedback. How could I make sure if they are indeed sent twice or just being logged twice ? Commented Feb 15, 2020 at 10:13
  • Inspect the traffic with a tool like tcpdump, wireshark or tshark. Commented Feb 15, 2020 at 10:32
  • Try to check the number of requests sent by inspecting the traffic through your browser's network console and share the response here Commented Feb 15, 2020 at 18:13

1 Answer 1

4

Chrome sends an extra GET request for a favicon. Add this to the head of your html to stop this request

<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.