Cloudflared Tunnel HTTP headers
How can I Pass headers in a cloudflared tunnel, I mean server-side headers that need to be passed to the end user?
I wasn't able to find any info about this, while I can use transform rules
I can't find any docs on about how can I pass a dynamic header
13 Replies
What do you mean by dynamic header?
These are the headers that I'm trying to pass...
this is where they get created in the application that is running behind Cloudflare
https://github.com/tabarra/txAdmin/blob/361fed4796d229c91b00407c2df45a3aa4c761f2/web/public/js/txadmin/base.js#L147
https://github.com/tabarra/txAdmin/blob/361fed4796d229c91b00407c2df45a3aa4c761f2/web/public/js/txadmin/base.js#L147
GitHub
txAdmin/web/public/js/txadmin/base.js at 361fed4796d229c91b00407c2d...
The official FiveM server management platform used by over 23k servers! - tabarra/txAdmin
it changes value randomly
You would need to run a worker in front for a header that advanced. Snippets should be able to do that but they are not available yet.
Interesting, can you give me more info on this?
or is this what you are talking about
https://developers.cloudflare.com/workers/examples/alter-headers/
Alter headers · Cloudflare Workers docs
You can also use the custom-headers-example template to deploy this code to your custom domain.
Similar to take but you would do the header modification before the
await fetch(request)
partCan the worker get headers from the origin? And pass them through? Or will I have to implement my logic?
Like from the response?
Yes, They will get the
X-TxAdmin-CsrfToken
form the origin
and send it to the user after he passes the zero trust authenticationWhat does the flow look like? Incoming request -> worker appends header -> origin or is more like incoming request -> worker -> origin then worker appends header to response to user?
I think it is like
incoming request -> worker -> origin then worker appends header to response to user
Then yeah the example you linked is probabaly best
This hedder
X-TxAdmin-CsrfToken
is created at the origin so it makes sense that this is how it will look like
as always thanks for the help