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

@tus/server: allow passing custom headers #519

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

fenos
Copy link
Collaborator

@fenos fenos commented Nov 21, 2023

Currently, the list of allowed headers is hard-coded and there is no way to add custom headers if not overwriting the entire OptionHandler.

This PR allows to whitelisting of additional custom headers that can be passed on OPTION responses to pass CORS

new Server({
 allowHeaders: ['X-Header-1', 'X-Header-2']
})

Copy link
Member

@Murderlon Murderlon left a comment

Choose a reason for hiding this comment

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

This feature makes a lot of sense.

Docs are still missing though.

packages/server/src/handlers/OptionsHandler.ts Outdated Show resolved Hide resolved
packages/server/src/handlers/OptionsHandler.ts Outdated Show resolved Hide resolved
packages/server/src/types.ts Outdated Show resolved Hide resolved
@Murderlon Murderlon changed the title feat: allow passing custom headers in the allow headers on OPTIONS re… @tus/server: allow passing custom headers Nov 21, 2023
@fenos fenos force-pushed the feat/custom-headers-on-options-res branch 2 times, most recently from d37373a to fb7d5b5 Compare November 22, 2023 10:03
Copy link
Member

@Murderlon Murderlon left a comment

Choose a reason for hiding this comment

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

Looks good, thanks. Still need to update the readme to explain this new option and then we're good.

@fenos fenos force-pushed the feat/custom-headers-on-options-res branch from fb7d5b5 to 520a4f4 Compare November 29, 2023 13:40
@fenos
Copy link
Collaborator Author

fenos commented Nov 29, 2023

@Murderlon documentation updated also added a test

@fenos fenos force-pushed the feat/custom-headers-on-options-res branch from 520a4f4 to 52075fb Compare November 29, 2023 13:44
@fenos
Copy link
Collaborator Author

fenos commented Nov 30, 2023

@Murderlon can this be merged now?

@Murderlon Murderlon merged commit a031df4 into tus:main Nov 30, 2023
2 checks passed
@fenos fenos deleted the feat/custom-headers-on-options-res branch November 30, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants