Skip to content

Commit b7f8cb5

Browse files
committed
Limit Access-Control-Allow-Origin to OPTIONS preflight requests #85
1 parent a23da6e commit b7f8cb5

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

proxy/proxymanager.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ func New(config *Config) *ProxyManager {
7575
// see: issue: #81, #77 and #42 for CORS issues
7676
// respond with permissive OPTIONS for any endpoint
7777
pm.ginEngine.Use(func(c *gin.Context) {
78-
79-
// set this for all requests
80-
c.Header("Access-Control-Allow-Origin", "*")
81-
8278
if c.Request.Method == "OPTIONS" {
79+
c.Header("Access-Control-Allow-Origin", "*")
8380
c.Header("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS")
8481

8582
// allow whatever the client requested by default

0 commit comments

Comments
 (0)