Skip to content

Commit

Permalink
Added changes for local dev using http
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-Iam committed Jul 29, 2023
1 parent c8db0e7 commit 769c39e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .env.dev.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

# Replace with your domain or host
HOST=localhost
HTTP_PROTOCOL=https://
HTTP_PROTOCOL=http://

# Frontend dev
NEXTAUTH_URL=https://localhost
OAUTH_REDIRECT_URI=https://localhost
NEXTAUTH_URL=http://localhost
OAUTH_REDIRECT_URI=http://localhost
BACKEND_API_BASE=http://backend:8000
NEXT_PUBLIC_BACKEND_API_BASE=https://localhost/ph-backend
NEXT_PUBLIC_BACKEND_API_BASE=http://localhost/ph-backend
NEXT_PUBLIC_NEXTAUTH_PROVIDERS=google,github,gitlab

# WARNING: Replace this with a cryptographically strong random value. You can use `openssl rand -hex 32` to generate this.
Expand All @@ -34,7 +34,7 @@ GITLAB_CLIENT_SECRET=

# Backend dev
ALLOWED_HOSTS=localhost,backend
ALLOWED_ORIGINS=https://localhost
ALLOWED_ORIGINS=http://localhost
SESSION_COOKIE_DOMAIN=localhost

# Database credentials. Change all these values as required, except DATABASE_HOST
Expand Down
6 changes: 3 additions & 3 deletions dev-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ services:
container_name: phase-nginx-dev
build:
context: .
dockerfile: ./nginx/Dockerfile
dockerfile: ./nginx/Dockerfile.dev
restart: always
ports:
- 80:80
- 443:443
# - 443:443
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./nginx/dev-default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- frontend
- backend
Expand Down
1 change: 1 addition & 0 deletions nginx/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM nginx
53 changes: 53 additions & 0 deletions nginx/dev-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
server {
listen 80;
# listen 443 ssl;

# ssl_certificate /etc/nginx/ssl/nginx.crt;
# ssl_certificate_key /etc/nginx/ssl/nginx.key;

location /ph-backend/ {
rewrite ^/ph-backend/(.*) /$1 break;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://backend:8000;
proxy_redirect off;

proxy_cookie_path / "/; HttpOnly; SameSite=strict";
}

location /kms/ {
rewrite ^/kms/(.*) /kms/$1 break;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://backend:8000;
proxy_redirect off;

proxy_cookie_path / "/; HttpOnly; SameSite=strict";
}

location / {
include /etc/nginx/mime.types;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

proxy_pass http://frontend:3000;
proxy_redirect off;
}
}

0 comments on commit 769c39e

Please sign in to comment.