cors changes applied & new-gw
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.olympus.apollo.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
||||
@@ -10,10 +11,13 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo
|
||||
@EnableWebSocketMessageBroker
|
||||
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
||||
|
||||
@Value("${apollo.fe.url}")
|
||||
private String apollo_frontend_url;
|
||||
|
||||
@Override
|
||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
registry.addEndpoint("/ws/endpoint")
|
||||
.setAllowedOrigins("http://olympus-api-gateway.olympusai.live")
|
||||
.setAllowedOrigins(apollo_frontend_url)
|
||||
.withSockJS();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
package com.olympus.apollo.security.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${apollo.fe.url}")
|
||||
private String apollo_frontend_url;
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOrigins("*")
|
||||
.allowedOrigins(apollo_frontend_url)
|
||||
.allowedHeaders("*")
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE");
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE","OPTIONS");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user