서승완
Builds for 2 pipelines passed in 55 minutes 52 seconds

Merge branch 'feature/cors' into 'master'

feat: add cors headers to django



See merge request !6
...@@ -32,6 +32,7 @@ ALLOWED_HOSTS = ['127.0.0.1', 'khubox-api.khunet.net'] ...@@ -32,6 +32,7 @@ ALLOWED_HOSTS = ['127.0.0.1', 'khubox-api.khunet.net']
32 32
33 INSTALLED_APPS = [ 33 INSTALLED_APPS = [
34 'khubox.apps.KhuboxConfig', 34 'khubox.apps.KhuboxConfig',
35 + 'corsheaders',
35 'django.contrib.admin', 36 'django.contrib.admin',
36 'django.contrib.auth', 37 'django.contrib.auth',
37 'django.contrib.contenttypes', 38 'django.contrib.contenttypes',
...@@ -43,6 +44,7 @@ INSTALLED_APPS = [ ...@@ -43,6 +44,7 @@ INSTALLED_APPS = [
43 MIDDLEWARE = [ 44 MIDDLEWARE = [
44 'django.middleware.security.SecurityMiddleware', 45 'django.middleware.security.SecurityMiddleware',
45 'django.contrib.sessions.middleware.SessionMiddleware', 46 'django.contrib.sessions.middleware.SessionMiddleware',
47 + 'corsheaders.middleware.CorsMiddleware',
46 'django.middleware.common.CommonMiddleware', 48 'django.middleware.common.CommonMiddleware',
47 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 'django.contrib.auth.middleware.AuthenticationMiddleware',
48 'django.contrib.messages.middleware.MessageMiddleware', 50 'django.contrib.messages.middleware.MessageMiddleware',
...@@ -129,3 +131,12 @@ S3_BUCKET = 'khubox-files' ...@@ -129,3 +131,12 @@ S3_BUCKET = 'khubox-files'
129 CDN_PATH = 'https://khubox-files.khunet.net' 131 CDN_PATH = 'https://khubox-files.khunet.net'
130 CLOUDFRONT_KEY_ID = 'APKAJ3FOBWI34OZJTXJQ' 132 CLOUDFRONT_KEY_ID = 'APKAJ3FOBWI34OZJTXJQ'
131 CLOUDFRONT_KEY_PRIVATE = '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEA18VtzURs+fQev5L00LRwRbJaObQI4kfJCIsOE7eWSO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ri9t8RKN91YKF\nUUFBsDEkWlkoAmfPkcrrq9cLJlmSNt3ehQj4p5iAJwoVBXXa++PO\n-----END RSA PRIVATE KEY-----'
134 +
135 +
136 +# Cors
137 +CORS_ALLOW_CREDENTIALS = True
138 +CORS_ORIGIN_WHITELIST = [
139 + 'http://localhost:3000',
140 + 'http://127.0.0.1:3000',
141 + 'https://khubox.khunet.net',
142 +]
......
...@@ -8,6 +8,7 @@ chardet==3.0.4 ...@@ -8,6 +8,7 @@ chardet==3.0.4
8 click==7.1.2 8 click==7.1.2
9 cryptography==2.9.2 9 cryptography==2.9.2
10 Django==1.11.29 10 Django==1.11.29
11 +django-cors-headers==3.2.1
11 docutils==0.15.2 12 docutils==0.15.2
12 durationpy==0.5 13 durationpy==0.5
13 future==0.18.2 14 future==0.18.2
......