-
Notifications
You must be signed in to change notification settings - Fork 834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added CORS headers to enable Front-End inputs on Go Engine #1952
Added CORS headers to enable Front-End inputs on Go Engine #1952
Conversation
Hi @ericandrewmeadows. Thanks for your PR. I'm waiting for a SeldonIO member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
executor/api/rest/middlewares.go
Outdated
@@ -16,6 +17,13 @@ const ( | |||
|
|||
contentTypeOptsHeader = "X-Content-Type-Options" | |||
contentTypeOptsValue = "nosniff" | |||
|
|||
corsAllowOriginHeader = "Access-Control-Allow-Origin" | |||
corsAllowOriginValue = "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default values for these headers are very lax from the security perspective. Maybe these values should be set from a custom config and the defaults should be made more strict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 - I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @ericandrewmeadows!
I think that the code looks good, besides what @SachinVarghese mentioned (which could be a blocker in some use cases). Maybe we could read Access-Control-Allow-Origin
from an environment variable?
I've also noticed that gorilla/mux
seems to provide support for CORS out of the box. Would it be possible to change it to use this implementation? It seems that it also takes care of adding the OPTIONS
handler.
/ok-to-test |
Tue Jun 16 08:30:07 UTC 2020 impatient try |
Tue Jun 16 08:30:20 UTC 2020 impatient try |
Tue Jun 16 08:30:20 UTC 2020 impatient try |
Tue Jun 16 18:42:46 UTC 2020 impatient try |
Tue Jun 16 18:44:00 UTC 2020 impatient try |
@adriangonz - after diving in very deep on Gorilla's CORS implementation, it isn't actually setting the headers, even though the library looks as if it would, rendering it unusable. This was tried a multitude of ways - I'm happy to chat through this on Slack tomorrow - But I went deep into testing and found that the library is just insufficient. |
The only Gorilla method that works properly is
I have returned my code that handles a hard-coded list of the types because the request presentation won't confuse any devs going forward. In comparison - my result:
|
/test integration Those are great insights on From my side, the changes look great now. I think this is ready to land once the integration tests pass. |
Wed Jun 17 09:09:34 UTC 2020 impatient try |
/test integration |
Wed Jun 17 13:20:30 UTC 2020 impatient try |
There are two failed tests, but TBH they just seem flaky (i.e. maybe waiting for Ambassador to come up). The core ones seem to pass.
@axsaucedo do you think that the |
@adriangonz - I was seeing those fail, and wasn't fully sure why. We do intercept and add the headers to all requests, so I don't perceive that causing a failure here. |
Yes, it seems that we may need to increase the number of retries in the batch processor. |
Fri Jun 19 15:10:38 UTC 2020 impatient try |
/approve @axsaucedo thanks for clarifying that point! In that case, I think it's safe to land this one. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adriangonz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@ericandrewmeadows: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@adriangonz yes batch test passed, currently failed test is |
failed to trigger Pull Request pipeline
|
Description
Fixes # CORS issue in Slack
Type of change
How Has This Been Tested?
Test Configuration:
go version go1.14.3 darwin/amd64
Checklist: