-
Notifications
You must be signed in to change notification settings - Fork 7
add BIRDHOUSE_PROXY_CORS_ALLOW_ORIGIN setting
#611
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
Conversation
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3837/Result ❌ FAILUREBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-216.rdext.crim.ca PAVICS-e2e-workflow-tests Pipeline ResultsTests URL : http://daccs-jenkins.crim.ca:80/job/PAVICS-e2e-workflow-tests/job/master/546/NOTEBOOK TEST RESULTS |
tlvu
left a comment
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.
A few minor changes requested but looks good otherwise.
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3846/Result ❌ FAILUREBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-216.rdext.crim.ca PAVICS-e2e-workflow-tests Pipeline ResultsTests URL : http://daccs-jenkins.crim.ca:80/job/PAVICS-e2e-workflow-tests/job/master/551/NOTEBOOK TEST RESULTS |
tlvu
left a comment
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.
Duplicate BIRDHOUSE_SSL_CERTIFICATE
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3855/Result 🆘 ABORTEDBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-91.rdext.crim.ca
|
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3854/Result 🆘 ABORTEDBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-91.rdext.crim.ca
|
| if ( $access_control_allow_origin ~ "^$" ) { | ||
| set $access_control_allow_origin '*'; | ||
| } | ||
| # assumes that the server default is configured or overriden by a specific locaiton block as needed |
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.
Is this if block needed anymore?
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 think so because the value could still be set explicitly (or resolved from variable expansions) to ''.
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.
typo 'locaiton'
| # Set to "*" to allow all origins by default | ||
| # If you want to restrict access, set this to the space-delimited allowed domain(s) | ||
| # Can use other variables if needed (e.g.: '${BIRDHOUSE_PROXY_SCHEME}://${BIRDHOUSE_FQDN_PUBLIC}') | ||
| export BIRDHOUSE_PROXY_CORS_ALLOW_ORIGIN="*" |
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.
One very small last thing:
Can we add a note here that reminds the user that if this is unset (or set to the empty string) then it will default to "*" (because of the if block in cors.include).
That might be something that would surprise users if they haven't looked too closely at cors.include
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.
On the other hand, if the user explicitly override it to empty string in env.local, maybe he wants to not allow '*' and if we still set to '*' in cors.include, is that a good thing?!
Is there any scenarios where the user really want that value to be empty string and we should not block that?
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.
If you set '' to the CORS header, it is just wrong (not one of its permitted standard values). It will unset the header in nginx response, while still sending mixed signals since other Access-Control-... headers would be present. Also, since set $vary_origin Origin; is set when != *, it would indicate that the result varies based on Origin, but doesn't actually perform that varying response.
I think overall, unless you list specific origins to allow, the intent is always *.
I will add the note though about auto-fix just to be explicit about it.
tlvu
left a comment
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.
Good for me know. Minor question about whether we should allow the user to override to empty string.
| if ( $access_control_allow_origin ~ "^$" ) { | ||
| set $access_control_allow_origin '*'; | ||
| } | ||
| # assumes that the server default is configured or overriden by a specific locaiton block as needed |
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.
typo 'locaiton'
| # Set to "*" to allow all origins by default | ||
| # If you want to restrict access, set this to the space-delimited allowed domain(s) | ||
| # Can use other variables if needed (e.g.: '${BIRDHOUSE_PROXY_SCHEME}://${BIRDHOUSE_FQDN_PUBLIC}') | ||
| export BIRDHOUSE_PROXY_CORS_ALLOW_ORIGIN="*" |
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.
On the other hand, if the user explicitly override it to empty string in env.local, maybe he wants to not allow '*' and if we still set to '*' in cors.include, is that a good thing?!
Is there any scenarios where the user really want that value to be empty string and we should not block that?
By the way, I think you could have avoided all the diff noise if you Bonus Git an auto detect a rename if the change is small. But if you also fix indentations within the same change, git will see a large diff and will think it's a new file, unrelated to the old name. |
It wasn't done in one step on my end. It was multiple commits spread out over a few days. |
Yes, I didn't mean for you to fix it now, too late now. I mean next time, if you do the rename in 2 commits (one commit just for rename, and one commit to modify the file content), the diff will be cleaner and we preserve the rename history. |
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3858/Result 🆘 ABORTEDBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-91.rdext.crim.ca
|
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3857/Result 🆘 ABORTEDBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-154.rdext.crim.ca
|
E2E Test ResultsDACCS-iac Pipeline ResultsBuild URL : http://daccs-jenkins.crim.ca:80/job/DACCS-iac-birdhouse/3856/Result 🆘 ABORTEDBIRDHOUSE_DEPLOY_BRANCH : add-cors-origin DACCS_IAC_BRANCH : master DACCS_CONFIGS_BRANCH : master PAVICS_E2E_WORKFLOW_TESTS_BRANCH : master PAVICS_SDI_BRANCH : master DESTROY_INFRA_ON_EXIT : true PAVICS_HOST : https://host-140-216.rdext.crim.ca
|
Overview
Add
BIRDHOUSE_PROXY_CORS_ALLOW_ORIGINsetting.Note
The
cors.include.templatediff looks massive, but the actual concrete change is only adding:Changes
Non-breaking changes
Access-Control-Allow-Originheader to be configured usingBIRDHOUSE_PROXY_CORS_ALLOW_ORIGINvariable.cors.includefile is converted to acors.include.templatefile to allow variable expansion.BIRDHOUSE_PROXY_CORS_ALLOW_ORIGIN="*"is used to retain the previous behaviour.BIRDHOUSE_PROXY_CORS_ALLOW_ORIGINvariable can reference other variables to allow dynamic configuration(notably, to reference
BIRDHOUSE_FQDN_PUBLICfor same-origin allowance).STAC_CORS_ORIGINSheader implications.access_control_allow_originvariable.Breaking changes
Related Issue / Discussion
CI Operations
birdhouse_daccs_configs_branch: master
birdhouse_skip_ci: false