modified: main_dc/nginx/nginx-ssl.conf

modified:   main_dc/yalarba/api_es/internal/router/setMiddleware.go
add headers nginx
This commit is contained in:
2025-11-15 04:51:50 +05:00
parent 2ac1c1574b
commit 5446bef3e9
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -138,6 +138,14 @@ server {
proxy_send_timeout 600; proxy_send_timeout 600;
proxy_read_timeout 600; proxy_read_timeout 600;
add_header 'Access-Control-Allow-Origin' 'http://localhost:3000' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, PATCH' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Content-Type,X-CSRF-Token,X-Requested-With' always;
if ($request_method = OPTIONS) {
return 204;
}
# Handle preflight requests # Handle preflight requests
if ($request_method = OPTIONS) { if ($request_method = OPTIONS) {
return 204; return 204;
@@ -30,7 +30,7 @@ func setupMiddlewares(r *chi.Mux) {
r.Use(cors.Handler(cors.Options{ r.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{"https://easysite102.ru", "http://localhost:3000"}, AllowedOrigins: []string{"https://easysite102.ru", "http://localhost:3000"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"}, AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"},
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"}, AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token", "X-Requested-With"},
ExposedHeaders: []string{"Link"}, ExposedHeaders: []string{"Link"},
AllowCredentials: true, AllowCredentials: true,
MaxAge: 300, // 5 минут MaxAge: 300, // 5 минут