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(api): resolve header overwriting and delimiter issue in Access-Control-Expose-Headers #4960

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

gacevicljubisa
Copy link
Contributor

@gacevicljubisa gacevicljubisa commented Jan 24, 2025

…response header

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

  • Replaced w.Header().Set with w.Header().Add to append headers rather than overwrite them.
  • Corrected delimiter for Access-Control-Expose-Headers from ; to , as per MDN documentation.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

  • Browser behavior: The semicolon delimiter (;) was causing issues, particularly in Chromium-based browsers. This was corrected by switching to a comma (,) delimiter for separating multiple header values.
  • Header overwriting: The use of w.Header().Set was causing overwriting of Access-Control-Expose-Headers. Replacing it with w.Header().Add ensures headers are appended, resolving inconsistencies in the response headers.

Related Issue (Optional)

[2.4.0] Access-Control-Expose-Headers is overridden, breaking browser Swarm apps #4959

Screenshots (if appropriate):

@Cafe137
Copy link

Cafe137 commented Jan 27, 2025

Would it be possible to add tests that check that headers are added instead of being replaced, to avoid a future regression?

@gacevicljubisa
Copy link
Contributor Author

Would it be possible to add tests that check that headers are added instead of being replaced, to avoid a future regression?

Yes, sure.

@istae istae marked this pull request as ready for review January 29, 2025 19:35
@istae istae requested review from istae and acha-bill as code owners January 29, 2025 19:35
@istae istae requested a review from janos January 29, 2025 19:35
pkg/api/bzz.go Outdated Show resolved Hide resolved
pkg/api/bzz_test.go Show resolved Hide resolved
@gacevicljubisa gacevicljubisa requested a review from janos January 30, 2025 14:25
Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for addressing my comments.

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.4.0] Access-Control-Expose-Headers is overridden, breaking browser Swarm apps
4 participants