Fix nginx config for proxy to API server
This commit is contained in:
parent
8676a62f1e
commit
543318dd8a
@ -8,6 +8,7 @@ COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine-slim
|
||||
RUN rm -f /etc/nginx/nginx.conf
|
||||
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
RUN chown -R nginx:nginx /usr/share/nginx/html
|
36
nginx.conf
36
nginx.conf
@ -26,24 +26,40 @@ http {
|
||||
|
||||
#gzip-static on;
|
||||
|
||||
proxy_cache_path /var/cache/nginx keys_zone=owl_cache:20m inactive=24h;
|
||||
|
||||
upstream backend {
|
||||
server owlboard-backend:8460;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
proxy_cache owl_cache;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
add_header Content-Security-Policy "default-src 'self'";
|
||||
|
||||
location / {
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
gzip_static on;
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
add_header Cache-Control "public, no-transform, max-age=1209600";
|
||||
}
|
||||
|
||||
location /misc/ {
|
||||
proxy_pass http://backend;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://backend;
|
||||
proxy_cache_key $scheme://$host$uri$is_args$query_string;
|
||||
proxy_ignore_headers Cache-Control;
|
||||
proxy_cache_valid 200 2m; # Evaluate whether 2m or 1m is more appropriate
|
||||
add_header Cache-Control "private, no-transform, max-age=120";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
export const version = '2023.7.1';
|
||||
export const versionTag = 'dev';
|
||||
export const versionTag = 'beta';
|
||||
export const showWelcome = true;
|
||||
|
Loading…
Reference in New Issue
Block a user