generated from VLADIMIR/template
fix
This commit is contained in:
@@ -125,7 +125,7 @@ func main() {
|
||||
// Server gRPC-Gateway
|
||||
gwServer := &http.Server{
|
||||
Addr: config.GrpcGatewayPort,
|
||||
Handler: csp(cors(gwmux)),
|
||||
Handler: cors(gwmux),
|
||||
}
|
||||
log.Printf("Serving %s for gRPC-Gateway\n", grpcGatewayHost)
|
||||
go func() {
|
||||
@@ -163,8 +163,12 @@ func main() {
|
||||
muxAdmin.Handle("/", fileServerAdmin)
|
||||
|
||||
// Server admin web
|
||||
adminWebServer := &http.Server{
|
||||
Addr: config.AdminClientPort,
|
||||
Handler: muxAdmin,
|
||||
}
|
||||
log.Printf("Serving %s for admin web \n", adminClientHost)
|
||||
log.Fatalln(http.ListenAndServe(config.AdminClientPort, muxAdmin))
|
||||
log.Fatalln(adminWebServer.ListenAndServe())
|
||||
}
|
||||
|
||||
func cors(h http.Handler) http.Handler {
|
||||
@@ -179,20 +183,6 @@ func cors(h http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
func csp(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set(
|
||||
"Content-Security-Policy",
|
||||
"default-src 'self'; "+
|
||||
"connect-src 'self' https://evening-detective-api.crabs-games.art; "+
|
||||
"script-src 'self'; "+
|
||||
"style-src 'self'; "+
|
||||
"img-src 'self' data:;",
|
||||
)
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func loggingMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
start := time.Now()
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Вечерний детектив</title>
|
||||
<script type="module" crossorigin src="/assets/index-DG2FkfFw.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DyzSWsJq.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CKIFqlVo.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+4
-1
@@ -10,6 +10,9 @@ services:
|
||||
- "8100:8100" # user
|
||||
- "8110:8110" # admin
|
||||
- "8120:8120" # files
|
||||
environment:
|
||||
- HOST=https://evening-detective.crabs-games.art
|
||||
- FILE_HOST=https://evening-detective-files.crabs-games.art
|
||||
networks:
|
||||
- crabs-network
|
||||
volumes:
|
||||
@@ -36,7 +39,7 @@ services:
|
||||
reproxy.3.port: "8110"
|
||||
reproxy.3.ping: "/"
|
||||
|
||||
# admin
|
||||
# files
|
||||
reproxy.4.server: "evening-detective-files.crabs-games.art"
|
||||
reproxy.4.route: "/(.*)"
|
||||
reproxy.4.dest: "http://evening_detective:8120/$$1"
|
||||
|
||||
@@ -58,7 +58,7 @@ func GetUserClientHost() string {
|
||||
}
|
||||
|
||||
func GetFileHost() string {
|
||||
host := os.Getenv("HOST")
|
||||
host := os.Getenv("FILE_HOST")
|
||||
if host != "" {
|
||||
return host
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user