Note: CORS is only supported in API Self-Hosted version 2.3.1 and above.
DRAFTABLE_APISH_DJANGO: |-: This is a new environment variable exposed to the Docker container andDRAFTABLE_APISH_DJANGO: |-It is required for CORS support. This is different and should not be confused withDRAFTABLE_APISH_NGINX: |-, and you can removeDRAFTABLE_APISH_NGINX: |-if no other configuration is being used inside that environment variable.enable_cors:: This variable which is seated under thedjango:key sets whether CORS is enabled or not on the instance. If set totrueCORS will be enabled on that instance.allowed_origins:: This variable which is seated under thecors:key allows you to provide a list of the allowed origins for CORS. The correct formatting for this field is:
allowed_origin_regexes:: This variable which is seated under thecors:key allows you to list the regular expressions matching the allowed originsallow_all_origins:: This variable which is seated under thecors:key allows you to turn on CORS requests from any origin. This is the equivalent of using * as a wildcard and needs to be set toTruefor this effect.
DRAFTABLE_APISH_DJANGO: |- you only need to add one of those fields for configuration to function. This allow_all_originsfield is obviously the easiest (it defaults to False), as it just allows requests from anywhere. A more secure configuration is one of the first two options being allowed_origins: and allowed_origin_regexes:.