Skip to content

Commit

Permalink
server configs
Browse files Browse the repository at this point in the history
  • Loading branch information
crizzzly committed Jan 5, 2025
1 parent 7512eb2 commit e153594
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ class WebConfig {
@Bean
fun corsConfigurer(): WebMvcConfigurer {
return object : WebMvcConfigurer {
val host = System.getenv("DB_HOST")
val port = System.getenv("DB_PORT")
val url = "http://${host}:${port}"

override fun addCorsMappings(registry: CorsRegistry) {
registry.addMapping("/api/**") // Adjust the path as needed
registry.addMapping("/**") // Adjust the path as needed
.allowedOrigins("*") // use Nginx as proxy for production
.allowedMethods("GET", "POST", "DELETE")
.allowedHeaders("Content-Type", "Authorization") // Specific headers
.allowedHeaders("*") // Specific headers
.maxAge(3600)
// .allowCredentials(true) // Only if needed, with CSRF protection
}
Expand Down

0 comments on commit e153594

Please sign in to comment.