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(middleware): compute client address #12222

Merged
merged 2 commits into from
Oct 14, 2024
Merged

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Oct 14, 2024

Changes

Closes #12215
Closes PLT-2587

Testing

Added a unit test.

Existing CI should pass

Docs

N/A

Copy link

changeset-bot bot commented Oct 14, 2024

🦋 Changeset detected

Latest commit: 6a2ae1f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Oct 14, 2024
}
throw new AstroError(AstroErrorData.StaticClientAddressNotAvailable);
clientIpAddress = getClientIpAddress(request);
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is done here so that we don't need to update each adapter to provide it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly!

Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

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

Should be able to add a test for this. I think this one would be the place: https://github.com/withastro/astro/blob/main/packages/astro/test/client-address.test.js

@ematipico
Copy link
Member Author

@matthewp the bug is around edge middleware specifically, we don't have those tests in core, I think

@ematipico ematipico requested a review from matthewp October 14, 2024 13:57
@ematipico
Copy link
Member Author

@matthewp added a unit test

@ematipico ematipico merged commit fb55695 into main Oct 14, 2024
13 checks passed
@ematipico ematipico deleted the fix/middleware-client-address branch October 14, 2024 14:35
@astrobot-houston astrobot-houston mentioned this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clientAddress error in Netlify Edge middleware
3 participants