feat: allow tauri app cors access

This commit is contained in:
litoral05
2026-05-05 17:33:48 +01:00
parent 92a383bd53
commit ece916c28e
2 changed files with 27 additions and 0 deletions
+2
View File
@@ -1,6 +1,7 @@
services:
postgres:
image: postgres:16
restart: unless-stopped
container_name: lr-openvpn-postgres
environment:
POSTGRES_DB: lr_openvpn
@@ -11,6 +12,7 @@ services:
backend:
build: .
restart: unless-stopped
container_name: lr-openvpn-backend
ports:
- "8080:8080"
@@ -0,0 +1,25 @@
package com.litoralregas.openvpn.common;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
@Configuration
public class CorsConfig {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins(
"http://localhost:1420",
"tauri://localhost"
)
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*");
}
};
}
}