#load_module /nginx/nginx/modules/ngx_stream_module.so;
user  sstf;

worker_processes  1;

error_log  /nginx/nginx/logs/error.log warn;

events {
    worker_connections  1024;
}


http {
    fastcgi_connect_timeout 300s;
    fastcgi_send_timeout 300s;
    fastcgi_read_timeout 300s;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    client_max_body_size 200M;
	
	proxy_connect_timeout   300s;
	proxy_send_timeout   300s;
	proxy_read_timeout   300s;
	send_timeout   300s;
    
    include       /nginx/nginx/conf/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /nginx/nginx/logs/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
	

    server {
        listen 22001;
        server_name 127.0.0.1;
		server_tokens off;
        root /nginx/nginx/html/sstf/;
        index index.html;
	    set $gateway "sstf-gateway.sstf-tv.svc.w05.ecadevbj1a.io";
        resolver 10.96.0.10   ipv6=off valid=30s;
location /login/ {
            alias /nginx/nginx/html/sstf; 
            index index.html ;
        }
location /webapi/ {
		    

	    proxy_set_header Host   $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Credentials 'true';
            add_header Access-Control-Expose-Headers "Origin,X-Requested-With,Content-Type,Accept";
            add_header Access-Control-Allow-Methods "GET,POST,OPTIONS";
            proxy_pass http://$gateway:22002$request_uri;
        }
location /webscan {
				alias /nginx/nginx/html/sstf; 
				index scanuse.html
		    try_files $uri $uri/ /scanuse.html ;
		}
location / {
		     try_files $uri $uri/ /index.html ;
		}
location /vue/health/ {
    default_type application/json;
    return 200 'UP';
}
}
     include vhosts/*.conf;

    
}