Bläddra i källkod

fix: drop CORS support

JustSong 2 år sedan
förälder
incheckning
db13ee6f93
4 ändrade filer med 0 tillägg och 17 borttagningar
  1. 0 1
      go.mod
  2. 0 2
      go.sum
  3. 0 2
      main.go
  4. 0 12
      middleware/cors.go

+ 0 - 1
go.mod

@@ -4,7 +4,6 @@ module message-pusher
 go 1.18
 
 require (
-	github.com/gin-contrib/cors v1.4.0
 	github.com/gin-contrib/gzip v0.0.6
 	github.com/gin-contrib/sessions v0.0.5
 	github.com/gin-contrib/static v0.0.1

+ 0 - 2
go.sum

@@ -9,8 +9,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
 github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
 github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
-github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
-github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
 github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
 github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
 github.com/gin-contrib/sessions v0.0.5 h1:CATtfHmLMQrMNpJRgzjWXD7worTh7g7ritsQfmF+0jE=

+ 0 - 2
main.go

@@ -10,7 +10,6 @@ import (
 	"log"
 	"message-pusher/channel"
 	"message-pusher/common"
-	"message-pusher/middleware"
 	"message-pusher/model"
 	"message-pusher/router"
 	"os"
@@ -56,7 +55,6 @@ func main() {
 	// Initialize HTTP server
 	server := gin.Default()
 	server.Use(gzip.Gzip(gzip.DefaultCompression))
-	server.Use(middleware.CORS())
 
 	// Initialize session store
 	if common.RedisEnabled {

+ 0 - 12
middleware/cors.go

@@ -1,12 +0,0 @@
-package middleware
-
-import (
-	"github.com/gin-contrib/cors"
-	"github.com/gin-gonic/gin"
-)
-
-func CORS() gin.HandlerFunc {
-	config := cors.DefaultConfig()
-	config.AllowOrigins = []string{"https://gin-template.vercel.app", "http://localhost:3000/"}
-	return cors.New(config)
-}