apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-config
  namespace: meajudafi
data:
  nginx.prod.conf: |
    worker_processes  5;  ## Default: 1

    events {
       worker_connections  4096;  ## Default: 1024
    }

    http {
        proxy_cache_path /tmp keys_zone=mycache:10m max_size=1g inactive=3d use_temp_path=off;

        server {
            listen 80;
            listen [::]:80;    

            location /progress {                
                expires -1;
                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-Proto $scheme;                

                proxy_pass          http://localhost:3000;
                proxy_read_timeout  90;
            }        

            location / {
                proxy_cache             mycache;
                proxy_cache_valid       any 1h;
                expires 30m;
                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-Proto $scheme;
                add_header              X-Proxy-Cache $upstream_cache_status;

                proxy_pass          http://localhost:3000;
                proxy_read_timeout  90;
            }
        }
    }
  nginx.dev.conf: |
    worker_processes  1;

    events {
       worker_connections  1025;
    }

    http {                

        server {
            listen 80;
            listen [::]:80;            

            location /progress {                
                expires -1;
                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-Proto $scheme;                

                proxy_pass          http://localhost:3000;
                proxy_read_timeout  90;
            }

            location / {                
                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-Proto $scheme;                

                proxy_pass          http://localhost:3000;
                proxy_read_timeout  90;
            }
        }
    }