Rework development page: Pre-build, Build, Populate.
[src/xds/xds-server.git] / lib / webserver / server.go
index 0905c77..4268b40 100644 (file)
@@ -1,6 +1,7 @@
 package webserver
 
 import (
+       "fmt"
        "net/http"
        "os"
 
@@ -113,6 +114,7 @@ func (s *Server) Serve() error {
        // Serve in the background
        serveError := make(chan error, 1)
        go func() {
+               fmt.Printf("Web Server running on localhost:%s ...\n", s.cfg.HTTPPort)
                serveError <- http.ListenAndServe(":"+s.cfg.HTTPPort, s.router)
        }()
 
@@ -152,12 +154,10 @@ func (s *Server) middlewareXDSDetails() gin.HandlerFunc {
 // CORS middleware
 func (s *Server) middlewareCORS() gin.HandlerFunc {
        return func(c *gin.Context) {
-
                if c.Request.Method == "OPTIONS" {
                        c.Header("Access-Control-Allow-Origin", "*")
                        c.Header("Access-Control-Allow-Headers", "Content-Type")
-                       c.Header("Access-Control-Allow-Methods", "POST, DELETE, GET, PUT")
-                       c.Header("Content-Type", "application/json")
+                       c.Header("Access-Control-Allow-Methods", "GET, POST, DELETE")
                        c.Header("Access-Control-Max-Age", cookieMaxAge)
                        c.AbortWithStatus(204)
                        return