15357fd3c0
yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarba
36 lines
910 B
Go
36 lines
910 B
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
"github.com/go-chi/cors"
|
|
)
|
|
|
|
func CommonMiddleware() []func(http.Handler) http.Handler {
|
|
return []func(http.Handler) http.Handler{
|
|
HandleOptions,
|
|
CORS(),
|
|
ZapLogger,
|
|
middleware.Recoverer,
|
|
middleware.RequestID,
|
|
cors.Handler(cors.Options{
|
|
AllowedOrigins: []string{
|
|
"https://xn--80abahjtcfl5d0a8di.xn--p1ai",
|
|
"https://begushiybashkir.ru",
|
|
"http://localhost:3000",
|
|
"http://localhost:3001",
|
|
"http://localhost:5173"},
|
|
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
|
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token", "X-Requested-With"},
|
|
ExposedHeaders: []string{
|
|
"Link",
|
|
"Content-Length",
|
|
"Set-Cookie",
|
|
},
|
|
AllowCredentials: true,
|
|
MaxAge: 300,
|
|
}),
|
|
}
|
|
}
|