
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;
    upstream frontend {
      server 172.17.0.1:44478;
    }
    
    upstream backend {
      server 172.17.0.1:7251;
    }

    server {
        listen       8000 ssl;
        server_name  localhost;
    
        ssl_certificate     kemkas.pem;
        ssl_certificate_key kemkas.key;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
        ssl_ciphers         HIGH:!aNULL:!MD5;
    
        #access_log  /var/log/nginx/host.access.log  main;
    
        location / {
            proxy_pass  https://frontend;
        }
    
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    
        location /Identity/ {
            proxy_pass_request_headers on;
            proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
            proxy_set_header X-Forwarded-Proto "$scheme";
            proxy_set_header X-Forwarded-Host "$http_host";
            proxy_pass   https://backend;
        }
              
        location /api/ {
            proxy_pass_request_headers on;
            proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
            proxy_set_header X-Forwarded-Proto "$scheme";
            proxy_set_header X-Forwarded-Host "$http_host";
            proxy_pass   https://backend;
        }
        location /signin- {
            proxy_pass_request_headers on;
            proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
            proxy_set_header X-Forwarded-Proto "$scheme";
            proxy_set_header X-Forwarded-Host "$http_host";
            proxy_pass   https://backend;
        }
        
        location /lib/ {
            proxy_pass   https://backend;
            proxy_pass_request_headers on;
        }
        location /js/ {
            proxy_pass   https://backend;
            proxy_pass_request_headers on;
        }
        location /css/ {
            proxy_pass   https://backend;
            proxy_pass_request_headers on;
        }
        location /img/ {
            proxy_pass   https://backend;
            proxy_pass_request_headers on;
        }
    }
}
