upstream iaas {
       server 5.5.13.81:28080 max_fails=1 fail_timeout=30s;
}

server {
    listen 80;
    server_name _;
    
    location / {
        proxy_pass http://iaas/;
        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_set_header   X-Forwarded-Host $server_name;
        proxy_read_timeout 12h;
        proxy_send_timeout 12h;
        proxy_connect_timeout 12h;
    }

    location ^~ /api/ {
        proxy_pass http://iaas/;
        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_set_header   X-Forwarded-Host $server_name;
        proxy_read_timeout 12h;
        proxy_send_timeout 12h;
        proxy_connect_timeout 12h;
    }

}


server {
    listen 8080;
    server_name _;

    location / {
        root  /frontend/dist/;
        try_files $uri $uri/ /index.html;
        index index.html;
    }
    
    location ^~ /api/ {
        proxy_pass http://5.5.13.81/;
        proxy_read_timeout 12h;
        proxy_send_timeout 12h;
        proxy_connect_timeout 12h;
    }

}
