Jrapp
04/20/2023, 6:30 PMexport async function proxy(req: NextApiRequest, res: NextApiResponse): Promise<{ statusCode, json }> {
const response = await fetch(`${process.env.ROOT_URL}${req.url}`, {
method: req.method,
headers: {
...(req.headers as any)
},
redirect: 'follow',
});
...
}
and this is the code using it:
async function index(req, res) {
await superTokensNextWrapper(
async (next) => {
return await verifySession()(req, res, next);
}, req, res
);
const response = await proxy(req, res);
return res.status(response.statusCode).json(response.json);
}
I'm thinking the error may be coming from the refreshing of sessions but im unsure how to check and tell. It seems like root the question is: "What triggers a 304 response"?if-none-match
was present which essentially tells the server to check if the response has changed from the last request. Deleting that header from the request before proxying it fixes the issue