Open myselfuser1 opened 7 months ago
Your filter is applied only for Spring web server, but netty-socket.io starts separate netty server and uses another port which you can specify in com.corundumstudio.socketio.Configuration
, it also contains getter/setter methods for allowed origin and headers
@shutuper Thanks for the reply. I updated the code to
@Configuration
public class SocketIOConfig {
@Bean
public SocketIOServer socketIOServer() {
com.corundumstudio.socketio.Configuration config = new com.corundumstudio.socketio.Configuration();
config.setPort(8081);
config.setOrigin("*"); // Allow requests from all origins
return new SocketIOServer(config);
}
}
But still i get cors issue, I am accessing http://localhost:8081
from frontend side
I am trying to connect my Next.js frontend to Spring boot backend in which I am using netty socketio server
I get 404 error in browser console
This is my backend code
I also added cors in my main application class
This is my frontend NextJs code
Complete source code here
Encountering a 404 error in the browser console when trying to connect your Next.js frontend to your Spring Boot backend using Netty Socket.IO server