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

Keep API Gateway headers in proxy requests #1764

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

kieran-sf
Copy link
Contributor

@kieran-sf kieran-sf commented Apr 26, 2024

Keep API Gateway headers in proxied requests

Description

Keep all API Gateway headers in requests sent to proxies. APIG headers are still stripped on requests to the origin.
WI

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • Keep APIG headers in proxy requests

How to Test-Drive This PR

  • The deploy test instance of MRT
  • Push this reference bundle
  • Add an httpbin proxy and request it with an x-api-key header

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@kieran-sf kieran-sf marked this pull request as ready for review April 26, 2024 16:48
@kieran-sf kieran-sf requested a review from a team as a code owner April 26, 2024 16:48
@@ -599,7 +599,7 @@ export const RemoteServerFactory = {
// do that now so that the rest of the code don't have to deal
// with these headers, which can be large and may be accidentally
// forwarded to other servers.
X_HEADERS_TO_REMOVE.forEach((key) => {
X_HEADERS_TO_REMOVE_ORIGIN.forEach((key) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Non-blocking longer term note: it might be useful to move this header removal to platform middleware to fully isolate the values from customer code

Copy link
Collaborator

@noahadams noahadams left a comment

Choose a reason for hiding this comment

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

This looks good, nice test updates 👍

* @private
* @type {string[]}
*/
export const X_HEADERS_TO_REMOVE_ORIGIN = [
Copy link
Collaborator

@adamraya adamraya Apr 30, 2024

Choose a reason for hiding this comment

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

@kieran-sf Would this be considered a breaking change?

If customers were relying on the removal or existence of those headers and suddenly found them present or missing in the requests, Could this lead to unexpected behaviour, errors or data exposure?

At the very least, are we planning on documenting the changes that could impact customers and provide examples for those who need to maintain the current behaviour?

Copy link
Collaborator

@adamraya adamraya May 1, 2024

Choose a reason for hiding this comment

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

We reviewed the changes and agreed that although there is technically a change in the behavior of the proxies, we don't expect significant consequences for existing apps that now include the headers that we were previously removing. We consider the changes to solve the reported bug.

@kieran-sf kieran-sf enabled auto-merge (squash) May 2, 2024 17:38
@kieran-sf kieran-sf mentioned this pull request May 2, 2024
12 tasks
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.

None yet

3 participants