-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
chore: Block POST requests to all page routes + remove /user & /user/type dynamic routes from middleware #19281
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (02/13/25)1 reviewer was added to this PR based on Keith Williams's automation. |
E2E results are ready! |
755fb40
to
45d1732
Compare
73fedd1
to
45d1732
Compare
"/:user/:type/", | ||
"/:user/", |
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.
these dynamic routes won't go through middleware anymore
const _pathname = h.get("x-pathname") ?? pathname ?? ""; | ||
const canonical = buildCanonical({ path: _pathname, origin: origin ?? CAL_URL }); | ||
const locale = h.get("x-locale") ?? (await getLocale(buildLegacyRequest(h, cookies()))) ?? "en"; |
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.
routes needed to go through middleware for these 2 special headers: x-pathname
and x-locale
.
However, getLocale can replace x-locale
and hard-coded pathname (passed as arg) can replace x-pathname
@@ -36,7 +36,8 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => { | |||
(t) => `${rescheduleUid && !!booking ? t("reschedule") : ""} ${title} | ${profileName}`, | |||
(t) => `${rescheduleUid ? t("reschedule") : ""} ${title}`, | |||
isBrandingHidden, | |||
getOrgFullOrigin(eventData?.entity.orgSlug ?? null) | |||
getOrgFullOrigin(eventData?.entity.orgSlug ?? null), | |||
`/${params.user}/${params.type}` |
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.
@@ -30,7 +30,8 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => { | |||
() => profile.name, | |||
() => markdownStrippedBio, | |||
false, | |||
getOrgFullOrigin(entity.orgSlug ?? null) | |||
getOrgFullOrigin(entity.orgSlug ?? null), | |||
`/${params.user}` |
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.
], | ||
}; | ||
|
||
export default collectEvents({ | ||
middleware: abTestMiddlewareFactory(middleware), |
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.
abTestMiddlewareFactory isn't used and needed (it was testing infra for app dir when we supported /future dir)
@@ -1,9 +0,0 @@ | |||
import { AB_TEST_BUCKET_PROBABILITY } from "@calcom/lib/constants"; |
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.
abTest dir itself is deprecated
@@ -1,62 +0,0 @@ | |||
import { getBucket } from "abTest/utils"; |
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.
abTest dir itself is deprecated
What does this PR do?
/api
(only /api/trpc/:path* and /api/auth/signup go through middleware btw)405 as expected
No 405 as expected for allowed endpoints
/[user]
and/[user]/[type]
dynamic routes from middleware while ensuring that metadata is still being created correctlyMandatory Tasks (DO NOT REMOVE)
How should this be tested?