Next.js Discord

Discord Forum

use redirects inside next.config to check missing searchparam and referer header with specific value

Unanswered
West African Lion posted this in #help-forum
Open in Discord
West African LionOP
/** @type {import('next').NextConfig} /
const nextConfig = {
async redirects() {
return [
{
source: '/auth/verify',
missing: [
{
type: 'query',
key: 'mobile',
value: '(\d{10})',
},
],
destination: '/auth/signin',
permanent: false,
},
{
source: '/auth/verify',
missing: [
{
type: 'header',
key: 'referer',
value: '(.
/auth/signin.*)',
},
],
destination: '/auth/signin',
permanent: false,
},
];
},
};

export default nextConfig;

How to merge both the redirects? Tried keeping both in single missing also. Either of types should be missing to do the redirect.

0 Replies