-
Notifications
You must be signed in to change notification settings - Fork 135
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
Feat: Allow overriding the proxying for external rewrite #630
Conversation
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super quick review because I'm busy again today.
Will do a deeper review on Monday
🦋 Changeset detectedLatest commit: 8ea7d39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
@@ -124,7 +125,7 @@ export async function resolveOriginResolver( | |||
* @__PURE__ | |||
*/ | |||
export async function resolveWarmerInvoke( | |||
warmer?: LazyLoadedOverride<Warmer> | "aws-lambda", | |||
warmer?: LazyLoadedOverride<Warmer> | IncludedWarmer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you update l 115 in a similar way string
-> IncludedOriginResolver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l 101 as well.
Maybe use the same as l86 everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments, LGTM.
Co-authored-by: Victor Berchet <victor@suumit.com>
@@ -26,6 +32,9 @@ export interface IPluginSettings { | |||
| LazyLoadedOverride<OriginResolver> | |||
| IncludedOriginResolver; | |||
warmer?: LazyLoadedOverride<Warmer> | IncludedWarmer; | |||
proxyExternalRequest?: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
- use
OverrideOptions["..."]
forwarmer
andproxyExternalRequest
DefaultOverrideOptions<any, any>
can also be changed forOverrideOptions
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultOverrideOptions<any, any> can also be changed for OverrideOptions, right?
Yes
OverrideOptions["..."] for warmer and proxyExternalRequest
We can't for the warmer, it is not defined in OverrideOptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I mixed with wrapper 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we can't use OverrideOptions
for the wrapper and the converter, it cause a few issue with typescript.
I'll revert to DefaultOverrideOptions<any,any>
@@ -84,6 +91,10 @@ export async function buildEdgeBundle({ | |||
: "sqs-lite", | |||
} | |||
: {}), | |||
originResolver: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add proxyExternalRequest
@conico974 can we merge this? |
@vicb Yeah if everything is ok for the fetch/cloudflare part |
It looks okay, I'll test this more thoroughly soon and fix any thing that would need to be fixed. Does that sound ok? |
(Having the dummy types will help me progress) |
This PR add an option to override the old
proxyRequest
fn that was used for external rewrites.It also automatically make the proxying when used in the external middleware, no need to do it in a converter or the wrapper.
By default it is the same as before, but it could use
fetch
for the proxying@vicb PTAL, i haven't tested the fetch part, i'd appreciate some feedback on this