-
Notifications
You must be signed in to change notification settings - Fork 207
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
[Miniflare 3] Assorted fixes #515
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, the `MF-Custom-Service` header was including on the `request` parameter passed to custom service functions. This usually wasn't a problem, but if the request ever made it back to the loopback server (e.g. via `caches.default.put(request, ...)`), it would be forwarded back to the custom service instead of the appropriate plugin router.
In Miniflare 2, we removed `Transfer-Encoding`, `Connection`, `Keep-Alive` and `Expect` headers from incoming Node HTTP requests, before constructing a Node HTTP request and dispatching this to a Worker. These headers are forbidden in `undici` `fetch` requests, as they get added automatically. We have a similar situation with custom service bindings: requests may be passed straight through to another `fetch`, so remove the same set of headers. We also remove `Content-Length: 0` headers from `dispatchFetch()` requests when a body is set to avoid `RequestContentLengthMismatch` errors.
...allowing Miniflare to cleanly exit if the cache API is used.
Previously, the URL inside Worker code included the host of the runtime, not what was passed to `dispatchFetch()`. Similarly, `fetch` calls to custom service bindings, included the host of the loopback server. This change passes through the original URLs in both cases, via a new `MF-Original-URL` header.
|
This was
linked to
issues
Feb 20, 2023
penalosa
approved these changes
Feb 24, 2023
mrbbot
added a commit
that referenced
this pull request
Feb 27, 2023
Similar to #475, we weren't deleting the `MF-Original-Header` URL from incoming requests, leading to incorrect URLs in the loopback server when the incoming request was passed-through as the cache key. Tests also needed to be updated as the storage location is now based off the actual URL passed to `dispatchFetch()`.
mrbbot
added a commit
that referenced
this pull request
Feb 27, 2023
Similar to #475, we weren't deleting the `MF-Original-URL` header from incoming requests, leading to incorrect URLs in the loopback server when the incoming request was passed-through as the cache key. Tests also needed to be updated as the storage location is now based off the actual URL passed to `dispatchFetch()`.
mrbbot
added a commit
that referenced
this pull request
Feb 27, 2023
Similar to #475, we weren't deleting the `MF-Original-URL` header from incoming requests, leading to incorrect URLs in the loopback server when the incoming request was passed-through as the cache key. Tests also needed to be updated as the storage location is now based off the actual URL passed to `dispatchFetch()`.
This was referenced Mar 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR includes fixes for a bunch of issues raised by @vlovich. See each commit description for a summary of the problem.