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

feat(next): supports relative preview URLs #9755

Merged
merged 4 commits into from
Dec 4, 2024
Merged

Conversation

jacobsfletch
Copy link
Member

@jacobsfletch jacobsfletch commented Dec 4, 2024

Similar to #9746. When deploying to Vercel, preview deployment URLs are dynamically generated. This breaks admin.preview within those deployments because there is no mechanism by which we can detect and set that URL within Payload. Although Vercel provides various environment variables at our disposal, they provide no concrete identifier for exactly which URL is being currently previewed (you can access the same deployment from a number of different URLs).

The fix is to support relative admin.preview URLs, that way Payload can prepend the application's top-level domain dynamically at render-time in order to create a fully qualified URL. So when you visit a Vercel preview deployment, for example, that deployment's unique URL is used as the preview redirect, instead of the application's root/production domain. Note: this does not fix multi-tenancy single-domain setups, as those still require a static top-level domain for each tenant.

@jacobsfletch jacobsfletch changed the title feat: supports relative preview URLs feat(next): supports relative preview URLs Dec 4, 2024
@jacobsfletch jacobsfletch marked this pull request as ready for review December 4, 2024 21:14
@jacobsfletch jacobsfletch merged commit 1fc9c47 into main Dec 4, 2024
53 checks passed
@jacobsfletch jacobsfletch deleted the fix/relative-preview branch December 4, 2024 22:01
Copy link
Contributor

github-actions bot commented Dec 6, 2024

🚀 This is included in version v3.5.0

@dominikzogg
Copy link
Contributor

@jacobsfletch i think is change is there reason for: #9830

jacobsfletch added a commit that referenced this pull request Dec 9, 2024
…livePreview.url functions (#9831)

Fixes #9830. Continuation of #9755 and #9746. Instead of automatically
appending TLDs to the `admin.preview` and the `livePreview.url` URLs, we
should instead ensure that `req` is passed through these functions, so
that you can have full control over the format of this URL without
Payload imposing any of its own formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants