@@ -29,10 +29,8 @@ import (
29
29
"runtime"
30
30
"runtime/debug"
31
31
"strconv"
32
- "strings"
33
32
"time"
34
33
35
- cors "github.com/andela/gin-cors"
36
34
cert "github.com/arduino/arduino-create-agent/certificates"
37
35
"github.com/arduino/arduino-create-agent/config"
38
36
"github.com/arduino/arduino-create-agent/globals"
@@ -42,6 +40,7 @@ import (
42
40
"github.com/arduino/arduino-create-agent/updater"
43
41
v2 "github.com/arduino/arduino-create-agent/v2"
44
42
paths "github.com/arduino/go-paths-helper"
43
+ cors "github.com/gin-contrib/cors"
45
44
"github.com/gin-gonic/gin"
46
45
"github.com/go-ini/ini"
47
46
log "github.com/sirupsen/logrus"
@@ -373,14 +372,16 @@ func loop() {
373
372
extraOrigins = append (extraOrigins , "https://127.0.0.1:" + port )
374
373
}
375
374
376
- r .Use (cors .Middleware (cors.Config {
377
- Origins : * origins + ", " + strings .Join (extraOrigins , ", " ),
378
- Methods : "GET, PUT, POST, DELETE" ,
379
- RequestHeaders : "Origin, Authorization, Content-Type" ,
380
- ExposedHeaders : "" ,
381
- MaxAge : 50 * time .Second ,
382
- Credentials : true ,
383
- ValidateHeaders : false ,
375
+ allowOrigings := []string {* origins }
376
+ allowOrigings = append (allowOrigings , extraOrigins ... )
377
+ r .Use (cors .New (cors.Config {
378
+ AllowOrigins : allowOrigings ,
379
+ AllowMethods : []string {"PUT" , "GET" , "POST" , "DELETE" },
380
+ AllowHeaders : []string {"Origin" , "Authorization" , "Content-Type" },
381
+ ExposeHeaders : []string {},
382
+ AllowCredentials : true ,
383
+ MaxAge : 50 * time .Second ,
384
+ AllowPrivateNetwork : true ,
384
385
}))
385
386
386
387
r .LoadHTMLFiles ("templates/nofirefox.html" )
0 commit comments