Only apply CORS headers in development
This commit is contained in:
@@ -44,13 +44,14 @@ func init() {
|
|||||||
log.Println("Successfully retrieved EULA blocked servers")
|
log.Println("Successfully retrieved EULA blocked servers")
|
||||||
|
|
||||||
app.Use(recover.New())
|
app.Use(recover.New())
|
||||||
|
|
||||||
|
if config.Environment == "development" {
|
||||||
app.Use(cors.New(cors.Config{
|
app.Use(cors.New(cors.Config{
|
||||||
AllowOrigins: "*",
|
AllowOrigins: "*",
|
||||||
AllowMethods: "HEAD,OPTIONS,GET",
|
AllowMethods: "HEAD,OPTIONS,GET",
|
||||||
ExposeHeaders: "Content-Type,X-Cache-Time-Remaining",
|
ExposeHeaders: "Content-Type,X-Cache-Time-Remaining",
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if config.Environment == "development" {
|
|
||||||
app.Use(logger.New(logger.Config{
|
app.Use(logger.New(logger.Config{
|
||||||
Format: "${time} ${ip}:${port} -> ${method} ${path} -> ${status}\n",
|
Format: "${time} ${ip}:${port} -> ${method} ${path} -> ${status}\n",
|
||||||
TimeFormat: "2006/01/02 15:04:05",
|
TimeFormat: "2006/01/02 15:04:05",
|
||||||
|
|||||||
Reference in New Issue
Block a user