diff --git a/.env.dev.example b/.env.dev.example index 1555b9e9c..72ab1f614 100644 --- a/.env.dev.example +++ b/.env.dev.example @@ -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. @@ -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 diff --git a/dev-docker-compose.yml b/dev-docker-compose.yml index bed702ad0..0a1952f55 100644 --- a/dev-docker-compose.yml +++ b/dev-docker-compose.yml @@ -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 diff --git a/nginx/Dockerfile.dev b/nginx/Dockerfile.dev new file mode 100644 index 000000000..007148685 --- /dev/null +++ b/nginx/Dockerfile.dev @@ -0,0 +1 @@ +FROM nginx \ No newline at end of file diff --git a/nginx/dev-default.conf b/nginx/dev-default.conf new file mode 100644 index 000000000..c194f2107 --- /dev/null +++ b/nginx/dev-default.conf @@ -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; + } +}