feat: allow tauri app cors access
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16
|
image: postgres:16
|
||||||
|
restart: unless-stopped
|
||||||
container_name: lr-openvpn-postgres
|
container_name: lr-openvpn-postgres
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: lr_openvpn
|
POSTGRES_DB: lr_openvpn
|
||||||
@@ -11,6 +12,7 @@ services:
|
|||||||
|
|
||||||
backend:
|
backend:
|
||||||
build: .
|
build: .
|
||||||
|
restart: unless-stopped
|
||||||
container_name: lr-openvpn-backend
|
container_name: lr-openvpn-backend
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "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("*");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user