diff --git a/docker/Dockerfile b/docker/Dockerfile index 56acc00d..236dd92b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,6 +25,12 @@ COPY vite.config.ts index.html tsconfig.json tsconfig.app.json tsconfig.node.jso COPY public /website/public COPY src /website/src +ARG VITE_API_URL=/api +ARG VITE_ORY_URL=/auth + +ENV VITE_API_URL=$VITE_API_URL +ENV VITE_ORY_URL=$VITE_ORY_URL + # Now build for optimal caching RUN pnpm run build diff --git a/docker/nginx.conf b/docker/nginx.conf index b4e555a2..f6257670 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -18,6 +18,8 @@ server { server_tokens off; absolute_redirect off; + resolver 127.0.0.11 ipv6=off valid=10s; + gzip on; gzip_vary on; gzip_comp_level 6; @@ -40,6 +42,47 @@ server { try_files $uri =404; } + location /auth/ { + set $up_kratos http://kratos:4433; + rewrite ^/auth/(.*)$ /$1 break; + proxy_pass $up_kratos; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_hide_header Cache-Control; + add_header Cache-Control $upstream_http_cache_control always; + } + + location /api/ { + set $up_kanae http://kanae:8000; + rewrite ^/api/(.*)$ /$1 break; + proxy_pass $up_kanae; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_hide_header Cache-Control; + add_header Cache-Control $upstream_http_cache_control always; + } + + location ~ ^/(kanae-media|kanae-public)/ { + set $up_garage http://garage:3900; + proxy_pass $up_garage; + proxy_set_header Host $http_host; + client_max_body_size 0; + proxy_request_buffering off; + proxy_hide_header Cache-Control; + add_header Cache-Control $upstream_http_cache_control always; + } + + location /public/ { + set $up_garage_web http://garage:3902; + rewrite ^/public/(.*)$ /$1 break; + proxy_pass $up_garage_web; + proxy_set_header Host kanae-public.web.garage.localhost; + proxy_hide_header Cache-Control; + add_header Cache-Control $upstream_http_cache_control always; + } + location / { try_files $uri $uri/ /index.html; }