Add config value for CDN origin.

This value is set as the Access-Control-Allow-Origin header value for
the application. When using Azure CDN, the CDN will consume this header
when it populates its cache and use it on subsequent requests.

It would be possible to make this the same as the Flask SERVER_NAME
value. We explicitly set SERVER_NAME for Celery worker processes because
they need that information to contruct URLs outside of the request cycle
(Flask can infer the server name within a request cycle). I decided not
to rely on SERVER_NAME though because it has side effects:

- It determines what `url_for` uses as the host domain (which would be
  fine).
- It makes it so that the Flask app can only server requests to that
  domain (probably fine, but it felt like too big a side effect).

Additionally, SERVER_NAME does not include the scheme. For all of these
reasons I opted to make CDN_ORIGIN a separate config value.
This commit is contained in:
dandds
2019-11-19 13:20:20 -05:00
parent c6187466a3
commit 08fc530223
4 changed files with 4 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
ASSETS_URL
CAC_URL = http://localhost:8000/login-redirect
CA_CHAIN = ssl/server-certs/ca-chain.pem
CDN_ORIGIN=http://localhost:8000
CELERY_DEFAULT_QUEUE=celery
CLASSIFIED = false
CONTRACT_END_DATE = 2022-09-14