Files
kube-cluster/ai-teacher/templates/frontend-configmap.yaml
T

37 lines
1.1 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ai-teacher.fullname" . }}-nginx
data:
default.conf: |
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Proxy API calls to the backend service
location ^~ /api/{
proxy_pass http://{{ include "ai-teacher.fullname" . }}-backend:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 120s;
}
# Vue Router — serve index.html for all non-asset routes
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets aggressively (content-hashed filenames)
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
gzip on;
gzip_types text/plain text/css application/javascript application/json;
gzip_min_length 1024;
}