-
Notifications
You must be signed in to change notification settings - Fork 742
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
Use zone_name
for deployment of custom hostnames
#4232
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"wrangler": minor | ||
--- | ||
|
||
fix: use `zone_name` to determine a zone when the pattern is a custom hostname | ||
|
||
In Cloudflare for SaaS, custom hostnames of third party domain owners can be used in Cloudflare. | ||
Workers are allowed to intercept these requests based on the routes configuration. | ||
Before this change, the same logic used by `wrangler dev` was used in `wrangler deploy`, which caused wrangler to fail with: | ||
|
||
✘ [ERROR] Could not find zone for [partner-saas-domain.com] |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @romeupalos thanks for this PR! Unfortunately I don't think this is the right fix for this issue, since we don't want to split the implementations of export async function getZoneForRoute(route: Route): Promise<Zone | undefined> {
const host = getHostFromRoute(route);
let id: string | undefined;
if (typeof route === "object" && "zone_id" in route) {
id = route.zone_id;
} else if (typeof route === "object" && "zone_name" in route) {
id = await getZoneIdFromHost(route.zone_name);
} else if (host) {
id = await getZoneIdFromHost(host);
}
return id && host ? { id, host } : undefined;
} Does that work for your use case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @penalosa I've incorporated your code suggestion and updated the PR. |
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.
@penalosa
I've removed this UT, since it does not seem to be correct when having Cloudflare for SaaS product in mind.
Please, let me know if it is ok to remove it.