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

fix: prevent overwriting of CloudFlare _headers file #8693

Merged
merged 4 commits into from
Jan 27, 2023
Merged

fix: prevent overwriting of CloudFlare _headers file #8693

merged 4 commits into from
Jan 27, 2023

Conversation

eltigerchino
Copy link
Member

fixes #8692

Adds the append flag a to the file writing method for _headers.
This appends the auto-generated headers to any existing _headers file copied from /static or creates a new one if it doesn't exist (as it did before).

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Jan 24, 2023

🦋 Changeset detected

Latest commit: 26ab757

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-cloudflare Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -22,10 +22,6 @@ export default function () {

const relativePath = posix.relative(tmp, builder.getServerDirectory());

builder.log.info(
`adapter-cloudfare is writing its own _headers file. If you have your own, you should duplicate the headers contained in: ${dest}/_headers`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If people had done this previously as we advised and now we are appending them, they will end up with duplicates. I don't know how much of an issue that is. Does this need to be considered a breaking change and major release?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right about this being a breaking change. I never thought of that.
Are there any examples of existing configurations and how people have been getting around this?

@Rich-Harris Rich-Harris merged commit e407f14 into sveltejs:master Jan 27, 2023
@Rich-Harris
Copy link
Member

thank you!

@github-actions github-actions bot mentioned this pull request Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adapter-cloudflare overwrites _headers file
4 participants