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

Unconditionally add Access-Control-Expose-Headers HTTP header #20220

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

NickCellino
Copy link
Contributor

@NickCellino NickCellino commented Jan 16, 2024

Description

This adds the following header to all Consul HTTP responses:

Access-Control-Expose-Headers: x-consul-default-acl-policy

The reasoning for this is in this RFC, but in summary, we need this header in order to support the HCP UI. Previously, we added this at startup conditionally if the cluster was being linked to HCP. With the changes in the RFC, we are allowing Consul to be linked to HCP at any time and adding this header unconditionally at startup is the simplest solution as it doesn't require us to reload configuration at runtime.

Testing & Reproduction steps

Manual test

Before
➜ http localhost:8500/v1/catalog/services
HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json
Date: Tue, 16 Jan 2024 17:08:27 GMT
Vary: Accept-Encoding
X-Consul-Default-Acl-Policy: deny
X-Consul-Effective-Consistency: leader
X-Consul-Index: 19
X-Consul-Knownleader: true
X-Consul-Lastcontact: 0
X-Consul-Query-Backend: blocking-query

{}
After
➜  http localhost:8500/v1/catalog/services
HTTP/1.1 200 OK
Access-Control-Expose-Headers: x-consul-default-acl-policy
Content-Length: 2
Content-Type: application/json
Date: Tue, 16 Jan 2024 18:29:13 GMT
Vary: Accept-Encoding
X-Consul-Default-Acl-Policy: deny
X-Consul-Effective-Consistency: leader
X-Consul-Index: 18
X-Consul-Knownleader: true
X-Consul-Lastcontact: 0
X-Consul-Query-Backend: blocking-query

{}

Links

Jira: https://hashicorp.atlassian.net/browse/CC-7045
RFC: https://docs.google.com/document/d/185Kj_pDcuOmmVOzIPZYsCLIIOFB_26bg9kWD7i8qgkQ/edit#heading=h.5gihsi8y54bu

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@github-actions github-actions bot added the theme/cli Flags and documentation for the CLI interface label Jan 16, 2024
@NickCellino NickCellino added pr/no-backport pr/no-changelog PR does not need a corresponding .changelog entry and removed pr/no-changelog PR does not need a corresponding .changelog entry labels Jan 16, 2024
@NickCellino NickCellino force-pushed the nickcellino/hosted-ui-http-header branch 2 times, most recently from 27b9050 to aae5ebb Compare January 16, 2024 20:39
@NickCellino NickCellino force-pushed the nickcellino/hosted-ui-http-header branch from aae5ebb to 5dda279 Compare January 16, 2024 21:38
@NickCellino NickCellino marked this pull request as ready for review January 17, 2024 15:04
Copy link
Contributor

@mkam mkam 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 to me!

@NickCellino NickCellino merged commit 34b343a into main Jan 22, 2024
91 checks passed
@NickCellino NickCellino deleted the nickcellino/hosted-ui-http-header branch January 22, 2024 15:18
@NickCellino NickCellino mentioned this pull request Jan 22, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-backport theme/cli Flags and documentation for the CLI interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants