Next.js Discord

Discord Forum

Debugging rewrites

Unanswered
Gharial posted this in #help-forum
Open in Discord
Avatar
GharialOP
how can i debug rewrites? I want to make this rewrite but it doesn't seem to work:
async rewrites() {
        return [
            {
                source: "/",
                destination: "/tenant-domains/:tenant",
                has: [
                    {
                        type: "host",
                        value: "(?<tenant>.*)",
                    },
                ],
            },
        ];
    },

even if i hardcode the tenant in it still doesn't work. Is there anything i'm missing about root rewrites? When i tried with a source that wasn't root it was working just fine.

5 Replies

Avatar
GharialOP
unfortunately not. I still receive: GET /
Avatar
yeah seems like you need to use middleware for multi tenancy here
next.config.js is very limited and i'm yet to see a functional multi tenant setup in nextjs with only next.config.js
Avatar
GharialOP
Alright, i'll try that. Thank you.