allowed origins modified to specific url

This commit is contained in:
Sumedh
2024-09-30 14:40:54 +00:00
parent 8a9f49ff4a
commit f4fd984733
2 changed files with 11 additions and 2 deletions

View File

@@ -1,15 +1,21 @@
package com.olympus.hermione.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("${hermione.fe.url}")
private String hermione_frontend_url;
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedOrigins(hermione_frontend_url)
.allowedHeaders("*")
.allowedMethods("GET", "POST", "PUT", "DELETE");
}

View File

@@ -16,4 +16,7 @@ spring.main.allow-circular-references=true
neo4j.uri=neo4j+s://e17e6f08.databases.neo4j.io:7687
neo4j.username=neo4j
neo4j.password=8SrSqQ3q6q9PQNWtN9ozqSQfGce4lfh_n6kKz2JIubQ
neo4j.password=8SrSqQ3q6q9PQNWtN9ozqSQfGce4lfh_n6kKz2JIubQ
hermione.fe.url="http://hermione.olympusai.live"