proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=10g 
                inactive=60m use_temp_path=off;

log_format cache '$remote_addr - $remote_user [$time_local] '
                     '"$request" $status $body_bytes_sent '
                     '"$http_referer" "$http_user_agent" '
                     'Cache: $upstream_cache_status';
server {
    listen 8021;


    location /sw.js {
        root /usr/share/nginx/html;
        add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
        add_header Pragma "no-cache";
        add_header Expires "0";

        # Отправьте файл с правильным типом MIME для сервисных работников.
        default_type application/javascript;
        try_files $uri =404;
    }

    location /api/ {
        proxy_pass http://toshi-moto_api_web_1:8121/api/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location / {
        root /usr/share/nginx/html;
        index index.html index.htm;
        try_files $uri $uri/ /index.html =404;
        
    }
}
