asifdxtreme closed pull request #275: SCB-328 CORS interceptor does not allow
header ?ACCEPT?
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/275
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/server/interceptor/cors/cors.go b/server/interceptor/cors/cors.go
index e0c60eda..4bf7b70a 100644
--- a/server/interceptor/cors/cors.go
+++ b/server/interceptor/cors/cors.go
@@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN
THE SOFTWARE.
The original code was modified to fit the Service-Center use case.
- */
+*/
package cors
import (
@@ -52,7 +52,7 @@ func New() *CORS {
c := new(CORS)
c.allowOrigin = "*"
c.allowCredentials = false
- c.allowHeaders = map[string]struct{}{"origin": {}, "content-type": {},
"x-domain-name": {}, "x-consumerid": {}}
+ c.allowHeaders = map[string]struct{}{"origin": {}, "accept": {},
"content-type": {}, "x-domain-name": {}, "x-consumerid": {}}
c.allowMethods = map[string]struct{}{"GET": {}, "POST": {}, "PUT": {},
"DELETE": {}, "UPDATE": {}}
c.maxAge = 1500
return c
@@ -89,7 +89,7 @@ func (cors *CORS) handlePreflightRequest(w
http.ResponseWriter, r *http.Request)
h = strings.ToLower(strings.TrimSpace(h))
if _, ok := cors.allowHeaders[h]; !ok {
cors.invalid(w, r)
- util.Logger().Warnf(nil, "only supported
headers: %v", util.MapToList(cors.allowHeaders))
+ util.Logger().Warnf(nil, "invalid header '%s',
only supported headers: %v", h, util.MapToList(cors.allowHeaders))
return
}
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services