Skip to content

Commit

Permalink
Merge pull request #218 from volunteers-for-city-projects/feature/https
Browse files Browse the repository at this point in the history
Added settings for https
  • Loading branch information
ArtemKAF authored Nov 19, 2023
2 parents 3db0c5e + a9227ec commit 986947d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
2 changes: 2 additions & 0 deletions backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@
GMAIL_API_CLIENT_SECRET = os.getenv('GMAIL_API_CLIENT_SECRET', '')
GMAIL_API_REFRESH_TOKEN = os.getenv('GMAIL_API_REFRESH_TOKEN', '')

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

CORS_ALLOWED_ORIGINS = [
'http://localhost:3000',
'http://80.87.109.180:3000',
Expand Down
54 changes: 29 additions & 25 deletions infra_bt/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
server {
listen 80;
server_tokens off;
client_max_body_size 20M;
listen 80;
server_tokens off;
client_max_body_size 20M;

root /usr/share/nginx/html/;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Real-IP $http_x_real_ip;

location /api/ {
proxy_set_header Host $http_host;
proxy_pass http://backend:8000/api/;
}
location /swagger/ {
proxy_set_header Host $http_host;
proxy_pass http://backend:8000/swagger/;
}
location /redoc/ {
proxy_set_header Host $http_host;
proxy_pass http://backend:8000/redoc/;
}
location /admin/ {
proxy_set_header Host $http_host;
proxy_pass http://backend:8000/admin/;
}
root /usr/share/nginx/html/;

location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.html break;
}
}
location /api/ {
proxy_pass http://backend:8000/api/;
}

location /swagger/ {
proxy_pass http://backend:8000/swagger/;
}

location /redoc/ {
proxy_pass http://backend:8000/redoc/;
}

location /admin/ {
proxy_pass http://backend:8000/admin/;
}

location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.html break;
}
}
}

0 comments on commit 986947d

Please sign in to comment.