[go: up one dir, main page]

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

Use custom domain for Preview Deployments #393

Open
thomaslenaour opened this issue Mar 12, 2024 · 3 comments
Open

Use custom domain for Preview Deployments #393

thomaslenaour opened this issue Mar 12, 2024 · 3 comments

Comments

@thomaslenaour
Copy link

Hello, is it possible to use a custom domain for preview deployments ? I'm having trouble configuring this.

Here is what I want to do:

Preview Deployments

Domain : preview.mydomain.com
Visit preview.mydomain.com then see Home Page.
Visit app.preview.mydomain.com then see App.
Visit {ORGANIZATION}.preview.mydomain.com then see the specific organization page.

Production Deployments

Domain : mydomain.com
Visit mydomain.com then see Home Page.
Visit app.mydomain.com then see App.
Visit {ORGANIZATION}.mydomain.com then see the specific organization page.

Has anyone managed to make it work like this?

Thanks in advance!

@Xennis
Copy link
Xennis commented May 19, 2024

Yes, that works without any issue. What's your error that you get?

My domain config:

  • www.preview.mydomain.app redirects (308) to preview.mydomain.app
  • *.preview.mydomain.app is assigned to my branch preview
  • preview.mydomain.app is assigned to my branch preview

My env config:

  • NEXT_PUBLIC_ROOT_DOMAIN=preview.mydomain.app

@joshualinog
Copy link

Yes, that works without any issue. What's your error that you get?

My domain config:

  • www.preview.mydomain.app redirects (308) to preview.mydomain.app
  • *.preview.mydomain.app is assigned to my branch preview
  • preview.mydomain.app is assigned to my branch preview

My env config:

  • NEXT_PUBLIC_ROOT_DOMAIN=preview.mydomain.app

I can't seem to get this to work. how is it that you are chaning your NEXT_PUBLIC_ROOT_DOMAIN? wouldn't that break it for the first use case?

@joshualinog
Copy link

check out this guide

https://vercel.com/guides/set-up-a-staging-environment-on-vercel

when @Xennis says this:

My env config:

  • NEXT_PUBLIC_ROOT_DOMAIN=preview.mydomain.app

I took this config and i added it in the environment variables UI tab of the project's settings in vercel. I created a preview environment variable and I made it match the branch i named preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants