-
Notifications
You must be signed in to change notification settings - Fork 7
allow custom cors headers for stac #599
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
Changes from 1 commit
7c2a5a9
d1b9f73
aae7483
5369091
8da406a
942cc07
2aa0cae
7d21fd9
b1c62a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| config/magpie/config.yml | ||
| config/proxy/conf.extra-service.d/stac.conf | ||
| config/proxy/conf.extra-directives.d/stac.conf | ||
| config/canarie-api/canarie_api_monitoring.py | ||
| service-config.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| map $http_origin $stac_origin_allowed { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remind me what the Nginx This block means if the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's mostly right... This block creates a new variable |
||
| default ${BIRDHOUSE_PROXY_SCHEME}://${BIRDHOUSE_FQDN_PUBLIC}; | ||
| ${_STAC_ADDITIONAL_CORS_ORIGINS} | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,8 @@ | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Host $host:$server_port; | ||
| proxy_buffering off; | ||
| include /etc/nginx/conf.d/cors.include; | ||
| proxy_hide_header 'Access-Control-Allow-Origin'; | ||
| add_header Access-Control-Allow-Origin $stac_origin_allowed; | ||
|
||
| } | ||
|
|
||
| # Automatically redirect to /stac/stac and exclude redirect when already using /stac | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,8 @@ export STAC_POPULATOR_BACKUP_IMAGE='${STAC_POPULATOR_BACKUP_DOCKER}:${STAC_POPUL | |
| # This must match the "stac_version" value in the current STAC catalog. | ||
| export PYSTAC_STAC_VERSION_OVERRIDE=1.0.0 | ||
|
|
||
| export _STAC_ADDITIONAL_CORS_ORIGINS='$(for origin in $STAC_ADDITIONAL_CORS_ORIGINS; do echo "$origin \$http_origin;"; done;)' | ||
|
||
|
|
||
| # add any new variables not already in 'VARS' or 'OPTIONAL_VARS' that must be replaced in templates here | ||
| # single quotes are important in below list to keep variable names intact until 'birdhouse-compose' parses them | ||
| EXTRA_VARS=' | ||
|
|
@@ -71,6 +73,7 @@ export DELAYED_EVAL=" | |
| STAC_MIGRATION_DOCKER | ||
| STAC_MIGRATION_IMAGE | ||
| STAC_POPULATOR_BACKUP_IMAGE | ||
| _STAC_ADDITIONAL_CORS_ORIGINS | ||
mishaschwartz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| " | ||
|
|
||
| OPTIONAL_VARS=" | ||
|
|
@@ -86,4 +89,5 @@ OPTIONAL_VARS=" | |
| \$STAC_MIGRATION_TAGGED | ||
| \$STAC_MIGRATION_DOCKER | ||
| \$STAC_MIGRATION_IMAGE | ||
| \$_STAC_ADDITIONAL_CORS_ORIGINS | ||
| " | ||
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 assume space delimited based on the for loop?
Would need to be indicated since
,/;are common variants when dealing with headers.I think it might also need the
${BIRDHOUSE_FQDN_PUBLIC}sincestac-browserself-pings thestacAPI.Should this parameter be in
stac/default.env, or this one should update the variable additively?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.
Yeah I'll need to update comments and documentation explaining the format of everything.
${BIRDHOUSE_FQDN_PUBLIC}is always allowed because it is the default value for the nginx map. So by default, requests from all domains (including ${BIRDHOUSE_FQDN_PUBLIC}) will allow it.It doesn't need to be. The default (withouth stac-browser) is that it is empty/unset.