spacewander commented on a change in pull request #6070:
URL: https://github.com/apache/apisix/pull/6070#discussion_r781783925
##########
File path: apisix/plugins/grpc-web.lua
##########
@@ -123,8 +122,14 @@ function _M.header_filter(conf, ctx)
core.response.set_header("Access-Control-Allow-Methods",
DEFAULT_CORS_ALLOW_METHODS)
core.response.set_header("Access-Control-Allow-Headers",
DEFAULT_CORS_ALLOW_HEADERS)
end
+
core.response.set_header("Access-Control-Allow-Origin",
DEFAULT_CORS_ALLOW_ORIGIN)
- core.response.set_header("Content-Type", ctx.grpc_web_mime or
DEFAULT_CORS_CONTENT_TYPE)
+
+ local response_mime = ctx.grpc_web_mime
+ if not response_mime then
+ response_mime = core.request.header(ctx, "Content-Type")
+ end
+ core.response.set_header("Content-Type", response_mime)
Review comment:
I am confused. The current code just get and reset the Content-Type when
the grpc_web_mime is missing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]