Doubled HTTP requests

after I’ve put jenkins behind cloudflare I started to see all of builds double.

And now, I started to see a lot of my requests on my main page double (not all of them, but a lot!)
Now, I figured, it could be this: (referenced from )

If an HTTP/1.1 client sends a request which includes a request body, but which does not include an Expect request-header field with the “100-continue” expectation, and if the client is not directly connected to an HTTP/1.1 origin server, and if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request.

How can I configure Cloudflare that this situation would not occur?

The quote is directly from the HTTP 1.1 specification at HTTP/1.1: Connections.

However based on this

I’d assume it should not be applicable, as the client is connected to an HTTP 1.1 origin. Considering this was written well before HTTP 2, I do assume this includes later versions as well.

I am not sure there is much you can do, Cloudflare will simply forward incoming requests as-is.

You could write a worker with some fancy tracking logic, which tries to recognise duplicate requests and filter them out, but I am not sure that will be easier than simply making sure your clients do not send duplicate requests.

But strangely my clients do not send duplicate requests if cloudflare proxying is not enabled.

What does their logging say as to why they do send them?

Thanks for trying to help me, Sandro.
I have checked the website from browser inspector too.

The issue is:
a) If I turn on Cloudflare
client -> single request -> cloudflare -> doubled request -> server
(And somehow in google analytics I also see an extra bounce visitor…)
b) If I turn off Cloudflare
client -> single request -> server

So you have verified there is only one single request sent from your client, but then the Cloudflare proxies connect twice and send the same request twice?

yes, that seems to be the situation.
And it is true for my python-django webpage and for the java based jenkins on the same server.

Do you happen to have any workers deployed on the Cloudflare account in question?

I have no idea what workers are, if I go to the workers tab in Cloudflare, it says I have 0 routes.
I think I haven’t set up any workers, all the setup subpages there are empty.
And actually now there’s this phenomenon with the main site only after Ezoic’s cloudflare app got installed and starts to proxy everything. But with jenkins I had to stop the doubled site build in the queue since last summer.

In that case I’d send a test request and write down three values.

  1. The value of the CF-Ray response header of the HTTP response your client receives.
  2. The values of the CF-Ray request headers which your server will receive with each request.

Then open a support ticket with Cloudflare and enquire how these values are related and why Cloudflare seemingly doubles a request.

The value of 1. should match one of the values in 2. but the other one should be different.

Hmm, I remember vaguely someone mentioning in this context another proxy. Are you sure Cloudflare is connecting to your server and not to some other proxy, which then doubles the request?

Ok. Can you please tell me how I can send a test request?

Well, via your clients.

But I’d really rather verify the issue I mentioned in my last posting as I still doubt this is Cloudflare :slight_smile:

well, in case of jenkins it is Cloudflare, and in case of my site it can be Ezoic. So the problem may also well be on my server, it just does not show up when I don’t use proxying on the non-static content.

I cant tell as I dont know your system, I just doubt that it is Cloudflare as Cloudflare typically only forwards request as they come in and doesnt duplicate anything.

But again, if you are absolutely sure there is nothing else involved, your only way to debug this is via aforementioned approach by recording the connection IDs and clarifying this with Cloudflare’s support.

Sorry, I’m not that advanced to know what you mean by my clients. I thought the client is the browser that displays my page and sends the http requests.
The test request you’ve mentioned should be something special that sends tom CF-Ray something right? And I should type a http request, say in curl, that is specific to cloudflare if I understand correctly.

Well, I presumed you have some custom client application which sends these requests.

But yes, you need to record the connection ID you get when you send the request, as well as record whatever you receive. That should be three values then according to your description.

But again, I would rather say it is something inbetween, like Ezoic.

I didn’t seem to send any cf-ray in any of the browsers requests, but I’ve received
56b5c1410e8a72f9-AMS in the response.
I’m not sure where the two other values come from.

I know it is beyond you, but if you could point me to some tutorial or help page for beginners in this topic, it would help me a lot.

As I wrote, you should receive one value in the response header on the client side and one each (two in total if you receive two requests) in the request header on the server side.

I am afraid there are no tutorials for that. You need to use the developer tools of your browser and the server logging in order to get that data.

But again, I cant stress this enough.