Next.js getServerSideProps redirection ERR_HTTP_HEADERS_SENT error

You can return this

return {
  redirect: {
    permanent: false,
    destination: "/login",
  },
  props:{},
};

instead of setting header.

That error arrived due to two responses sent by the serversideprops. One in the return and one by header.

You can read more about redirect here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)