Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject arbitrary HTTP headers #258

Open
ithinkihaveacat opened this issue Apr 25, 2017 · 3 comments
Open

Inject arbitrary HTTP headers #258

ithinkihaveacat opened this issue Apr 25, 2017 · 3 comments
Labels
App Idea Ideas for new Cloudflare Apps

Comments

@ithinkihaveacat
Copy link

One specific example is an origin-trial header, as used by Chrome.

@Jos512
Copy link

Jos512 commented Jun 28, 2017

Good idea! And this would be a reason to develop an app (and I'd very much like to have this feature in Cloudflare). But after reading through the documentation I doubt if this is possible.

Adding custom HTTP headers requires the app to run before the page loads, which doesn't seem to be possible given the features outline in the docs. It also contradicts the definition of what a Cloudflare App is:

At its core a Cloudflare app is set of JavaScript and/or CSS files which run on a website, and an install.json file which instructs tools like Cloudflare Apps how to use those files.

Source (bold added).

To add HTTP headers to request, at the minimum the app needs to do:

  • Get the status of the request, because we likely don't need to add headers to requests already cached in the edge node (i.e., cf-cache-status: HIT).
  • Read all of the HTTP headers (both those coming from the origin and those added/changed by Cloudflare based on the configuration).
  • Determine if the custom HTTP header needs to be added (or if it's already there).
  • Return the customised request to the user requesting the file.

I of course hope I'm mistaken, but none of these things seem possible (at this point).

@GirlBossRush GirlBossRush added the App Idea Ideas for new Cloudflare Apps label Mar 2, 2018
@radiusops
Copy link

Thank you very much for this Good Idea. Its really easy to understand language you have used here. Lot of information for the beginners. This will help me a lot for HTTP header on my website.
Keep on writing and share your knowledge for the beginners.

All the Best
Alam
Freelancer

@matthewoates
Copy link

This is now possible with Cloudflare Workers. https://www.cloudflare.com/products/cloudflare-workers/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Idea Ideas for new Cloudflare Apps
Projects
None yet
Development

No branches or pull requests

5 participants