events {
    worker_connections 2024;
}

http {

       proxy_read_timeout 600;
       proxy_connect_timeout 600;
       proxy_send_timeout 600;

    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    server {
        listen 8001;

        client_max_body_size 5G;

        location / {
            proxy_http_version 1.1;
            proxy_pass http://localhost:5173;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }

        location /api {

            proxy_http_version 1.1;
            proxy_pass http://localhost:8080;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }

        location /glassdoor {

            rewrite ^/glassdoor(.*)$ $1 break;

            proxy_http_version 1.1;
            proxy_pass https://glassdoor.com;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }
    }
}
