Skip to content

Only add x-fah-middleware header to routes that have middleware enabled #325

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

Merged
merged 8 commits into from
May 2, 2025

Conversation

mathu97
Copy link
Collaborator

@mathu97 mathu97 commented Apr 8, 2025

Currently x-fah-middleware header is being added to all routes of an app that has a middleware file.

This PR updates the logic to only add x-fah-middleware header to routes that have middleware enabled. This is done by reading the middleware-manifest.json to get the routes that middleware is enabled on, and updating the routes-manifest.json file with the x-fah-middleware headers.

Testing this change locally:

  1. Added a middleware.ts file that only matches the /blah route.
Screenshot 2025-05-02 at 12 13 54 PM
  1. Build the app with the NextJs Adapter
  2. Ran the app and saw the x-fah-middleware header only being added to the /blah route
Screenshot 2025-05-02 at 12 33 40 PM Screenshot 2025-05-02 at 12 34 04 PM

@mathu97 mathu97 marked this pull request as ready for review April 11, 2025 16:54
@mathu97 mathu97 changed the title Only add x-fah-middleware routes to routes that have middleware enabled Only add x-fah-middleware header to routes that have middleware enabled Apr 11, 2025
Copy link
Collaborator

@annajowang annajowang left a comment

Choose a reason for hiding this comment

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

lgtm from me on good looking code

@mathu97 mathu97 requested a review from leoortizz as a code owner May 2, 2025 16:38
@mathu97 mathu97 merged commit 126f46c into main May 2, 2025
11 checks passed
@mathu97 mathu97 deleted the feat/scope-down-middleware-routes branch May 2, 2025 17:26
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.

3 participants