server {
    listen 8080;
    charset utf-8;
    client_max_body_size 100M;
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";

    location / {
        root /var/www/html;
        try_files $uri /index.html;
    }

    location /v1/ {
        proxy_pass http://backend:8000/v1/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
        proxy_read_timeout  300;
    }

    location /admin/ {
        proxy_pass http://backend:8000/admin/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    location = /admin {
        absolute_redirect off;
        return 301 /admin/;
    }

    location /swagger/ {
        proxy_pass http://backend:8000/swagger/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    location = /swagger {
        absolute_redirect off;
        return 301 /swagger/;
    }

    location /static/ {
        autoindex on;
        alias /static/;
    }

    location /media/ {
        autoindex on;
        alias /media/;
    }
}

server_tokens off;
