-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Description
I get an Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the clienterror when trying to use redirect inside getServerSideProps like this:
import type { GetServerSidePropsContext, NextPage } from 'next';
import Head from 'next/head';
const Dummy: NextPage = () => {
return (
<>
<Head>
<title>Title</title>
</Head>
<div>
<p>dummy page 1</p>
</div>
</>
);
};
export const getServerSideProps = (context: GetServerSidePropsContext) => {
const { locale = 'en' } = context;
return {
redirect: {
destination: '/dummy2',
permanent: false,
},
};
};
export default Dummy;
``Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels