Skip to content

Commit

Permalink
Modify default CORS settings
Browse files Browse the repository at this point in the history
Sending credentials is now enabled by default. The change comment header
is whitelisted and can be used from UIs.

A bunch of explanatory comments was added to the settings file with
pointers on what might be reasonable to override in local settings.

JIRA: PDC-1088
  • Loading branch information
lubomir committed Nov 5, 2015
1 parent d5f948e commit e77c62c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pdc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,38 @@
LDAP_GROUPS_DN = "ou=groups,dc=example,dc=com"
LDAP_CACHE_HOURS = 24


#
# CORS settings
#

# The requests can come from any origin (hostname). If this is undesirable, use
# settings_local.py module, set this to False and either set
# CORS_ORIGIN_WHITELIST to a tuple of hostnames that are allowed to contact the
# API, or set CORS_ORIGIN_REGEX_WHITELIST, which again is a tuple of regular
# expressions.
CORS_ORIGIN_ALLOW_ALL = True

# Only the REST API can be accessed. If settings local override REST_API_URL,
# make sure to update this setting as well.
CORS_URLS_REGEX = '^/%s.*$' % REST_API_URL

# We want HTML/JS clients to be able to use Kerberos authentication.
CORS_ALLOW_CREDENTIALS = True

# Allow default headers from django-cors-headers package as well as
# PDC-Change-Comment custom header.
CORS_ALLOW_HEADERS = (
'x-requested-with',
'content-type',
'accept',
'origin',
'authorization',
'x-csrftoken',
'pdc-change-comment',
)


# mock kerberos login for debugging
DEBUG_USER = None

Expand Down

0 comments on commit e77c62c

Please sign in to comment.