Rewrites socket still pending
Unanswered
Saltwater Crocodile posted this in #help-forum
Saltwater CrocodileOP
This is my code rewrites
It works well with HTTP requests but it doesn't work with WebSocket. It's pending at ws://localhost:3000/api/v1/socket/?EIO=4&transport=websocket
async rewrites() {
return [
{
source: '/api/:path*',
destination: `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/:path*/`,
},
];
},
It works well with HTTP requests but it doesn't work with WebSocket. It's pending at ws://localhost:3000/api/v1/socket/?EIO=4&transport=websocket
const socket = io('/', {
path: '/api/v1/socket',
transports: ['websocket'],
});
3 Replies
/socket/
Saltwater CrocodileOP
@gin It's still pending after adding /
const socket = io('/', {
path: '/api/v1/socket/',
transports: ['websocket'],
});