Cloudflare tunnel HTTP header request

We recently started using cloudflare tunnel for our websites. Today we discovered something odd and will need help about it. Clients sends a header to webserver and receive some information back which will be used for later. But with cloudflare tunnel it seems the header is not being sent to origin server thus receiving null response. We tried this workflow without using tunnel and it works perfectly. So its obviously something about cloudflare tunnel. Can you help ?

That’s certainly interesting. I’m guessing it’s a fairly unique header. Does it have any weird formatting?

I suggest you open a ticket via email (support AT cloudflare DOT com) and post the ticket # here so we can escalate. I’d love to hear how this works out.

yes its a custom header. I m sharing its name and value below. Ticket ID : 2355087
“platform : mobile”

The header is “platform” and the value is “mobile”?

I can confirm that my request that included that header didn’t make it to my site behind cloudflared.

I was going to try a Transform Header, but can’t get this Rule to match in order to send a request header as a workaround. Maybe another @MVP can spot the problem:
all(http.request.headers['platform'][*] == "mobile")

I’ve added the ticket # to the escalation queue.

Some headers might be stripped, but it might not be related to the tunnel but rather CF network. I’d test this in a worker and see if it’s stripped then too.

1 Like

I just deployed a http echoer behind tunnel and tried the same thing. It works and it echoes back the header I post. I am so confused right now. I will share repo link of the http echo tool below.
@thomas4 any updates you can share ? By the way we are using core at backend side. I don’t know if its relevant or not.

GitHub - mendhak/docker-http-https-echo: Docker image that echoes request data as JSON; listens on HTTP/S, useful for debugging.

If the echoer gives back the headers, then it’s not a Cloudflare issue but a back-end/origin issue. I’m not a developer so I don’t know how to solve it, but it’s definitely software related.

Ok I got some more info about this issue. One of my colleagues asked me if Cloudflared is coded with go. So I checked its repos and yes it was. He told me that there is a thing with go which changes headers first letter to uppercase and that might be the issue. So what I did was;

  1. Added 2 new args to startup script : ‘–loglevel debug --transport-loglevel debug’
  2. Posted the same request with same header and value : ‘platform : mobile’

here is the logs cloudflared provided after enabling debug level logging

2022-01-21T12:47:42Z DBG Inbound request CF-RAY=******-BUD Header="map[Accept-Encoding:[gzip] Cdn-Loop:[cloudflare] Cf-Connecting-Ip:[*****] Cf-Ipcountry:[TR] Cf-Ray:[******-BUD] Cf-Visitor:[{\"scheme\":\"https\"}] Cf-Warp-Tag-Id:[*****] Content-Length:[69] Content-Type:[application/json] Cookie:[.AspNetCore.Cookies=***; .AspNetCore.Identity.Application=*******] **Platform:[mobile]** Postman-Token:[*****] X-Forwarded-For:[****] X-Forwarded-Proto:[https] X-Sp-Gateway-Tag:[*****]]" host=****** path=/Login/Login rule=0

as you can see header request is ‘Platform’ instead of ‘platform’ and our backend might be case sensitive for this data I will check this with my colleagues.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.