Просмотр исходного кода

Updated django-cors-headers to v3.0.2

Jeremy Stretch 6 лет назад
Родитель
Сommit
dd554ee7b5
4 измененных файлов с 14 добавлено и 3 удалено
  1. 5 0
      CHANGELOG.md
  2. 7 1
      docs/configuration/optional-settings.md
  3. 1 1
      netbox/netbox/configuration.example.py
  4. 1 1
      requirements.txt

+ 5 - 0
CHANGELOG.md

@@ -160,6 +160,11 @@ lives in the `extras` app and thus any permissions that you may have configured
 to now use "Extras | Tag." Also note that the admin interface for tags has been removed as it was redundant to the
 to now use "Extras | Tag." Also note that the admin interface for tags has been removed as it was redundant to the
 functionality provided by the front end UI.
 functionality provided by the front end UI.
 
 
+### CORS_ORIGIN_WHITELIST Requires URI Scheme
+
+If you have the `CORS_ORIGIN_WHITELIST` configuration parameter defined, note that each origin must now incldue a URI
+scheme. This change was introuced in django-cors-headers 3.0.
+
 ## Enhancements
 ## Enhancements
 
 
 * [#166](https://github.com/digitalocean/netbox/issues/166) - Add `dns_name` field to IPAddress
 * [#166](https://github.com/digitalocean/netbox/issues/166) - Add `dns_name` field to IPAddress

+ 7 - 1
docs/configuration/optional-settings.md

@@ -72,7 +72,13 @@ If True, cross-origin resource sharing (CORS) requests will be accepted from all
 
 
 ## CORS_ORIGIN_REGEX_WHITELIST
 ## CORS_ORIGIN_REGEX_WHITELIST
 
 
-These settings specify a list of origins that are authorized to make cross-site API requests. Use `CORS_ORIGIN_WHITELIST` to define a list of exact hostnames, or `CORS_ORIGIN_REGEX_WHITELIST` to define a set of regular expressions. (These settings have no effect if `CORS_ORIGIN_ALLOW_ALL` is True.)
+These settings specify a list of origins that are authorized to make cross-site API requests. Use `CORS_ORIGIN_WHITELIST` to define a list of exact hostnames, or `CORS_ORIGIN_REGEX_WHITELIST` to define a set of regular expressions. (These settings have no effect if `CORS_ORIGIN_ALLOW_ALL` is True.) For example:
+
+```
+CORS_ORIGIN_WHITELIST = [
+    'https://example.com',
+]
+```
 
 
 ---
 ---
 
 

+ 1 - 1
netbox/netbox/configuration.example.py

@@ -72,7 +72,7 @@ CHANGELOG_RETENTION = 90
 # CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
 # CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
 CORS_ORIGIN_ALLOW_ALL = False
 CORS_ORIGIN_ALLOW_ALL = False
 CORS_ORIGIN_WHITELIST = [
 CORS_ORIGIN_WHITELIST = [
-    # 'hostname.example.com',
+    # 'https://hostname.example.com',
 ]
 ]
 CORS_ORIGIN_REGEX_WHITELIST = [
 CORS_ORIGIN_REGEX_WHITELIST = [
     # r'^(https?://)?(\w+\.)?example\.com$',
     # r'^(https?://)?(\w+\.)?example\.com$',

+ 1 - 1
requirements.txt

@@ -1,6 +1,6 @@
 Django>=2.2,<2.3
 Django>=2.2,<2.3
 django-cacheops==4.1
 django-cacheops==4.1
-django-cors-headers==2.5.3
+django-cors-headers==3.0.2
 django-debug-toolbar==1.11
 django-debug-toolbar==1.11
 django-filter==2.1.0
 django-filter==2.1.0
 django-mptt==0.9.1
 django-mptt==0.9.1