I have a next.js application which has to authenticate Clerk. I want it to redirect the user to the app.redaquest.com/onboarding subdomain upon successful registration but currently it redirects me to redaquest.com upon successful registration.
In the enviromental variables I have set NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL=https://app.redaquest.com/dashboard
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL=https://app.redaquest.com/onboarding
I have the redaquest domain and also the app.redaquest.com subdomain with another hosting provider (hostcreators). There I have such dns records :
*.redaquest.com CNAME redaquest.com
ssh.redaquest.com CNAME vps121.hostcreators.en
smtp.redaquest.com CNAME smtp.tomarco.sk
imap.redaquest.com CNAME imap.tomarco.sk
pop3.redaquest.com CNAME pop3.tomarco.sk
_autodiscover._tcp.redaquest.com SRV 0 0 443 autodiscover.tomarco.sk
redaquest.com TXT v=spf1 and mx include:_spf.tomarco.sk -all
_dmarc.redaquest.com TXT v=DMARC1; p=reject; sp=reject; rua=mailto:dmarc@tomarco.sk; ruf=mailto:dmarc@tomarco.sk; pct=100; fo=1; adkim=r; aspf=r
redaquest.com A 76.76.21.21
www.redaquest.com CNAME cname.vercel-dns.com
app.redaquest.com CNAME cname.vercel-dns.com
Can you please help me ?
pawlean
(Pauline P. Narvas)
November 22, 2024, 1:36pm
2
Hi, @stefankubala ! Welcome!
Thanks for the detailed post! Let me try and help you out here.
Your DNS configuration looks correct with:
I want to say that I don’t think this is a domain issue, so with that said let’s try looking at other areas:
Verify Next.js Route Setup
Confirm that you have created the /onboarding
route in your Next.js app
Create the following file structure if it doesn’t exist:
app/onboarding/page.tsx
Check Clerk Configuration
Verify your Clerk environment variables are set in Vercel
Ensure the redirect URLs are configured in Clerk Dashboard
Double-check the URL format (https:// prefix, no trailing slash)
Test Middleware Configuration
Add logging to your middleware to debug the redirect flow:
import { authMiddleware } from "@clerk/nextjs";
export default authMiddleware({
beforeAuth: (req) => {
console.log("Incoming request:", req.url);
return;
},
afterAuth: (auth, req) => {
console.log("Auth state:", auth.isPublicRoute, auth.isSignedIn);
return;
},
});
export const config = {
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};
Verify Production Build
Run a production build locally to test:
npm run build
npm run start
Let us know how you get on!
system
(system)
Closed
December 22, 2024, 1:36pm
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.