---

apiVersion: v1
kind: ConfigMap
metadata:
  name: lit-nginx-conf
data:
  lit.conf: |-

    upstream lit_backend {
        server production-lit:3000;
        keepalive 64;
    }

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

        server_name localhost;
        root /apps/lit-shared/public;

        access_log /dev/stdout main;
        error_log /dev/stderr error;

        # set_real_ip_from    10.1.0.0/16;
        # real_ip_header      X-Forwarded-For;

        if ($http_x_forwarded_proto = "http") {
            return 301 https://$host$request_uri;
        }

        location / {
            if (-f $request_filename) { break; }
            proxy_pass http://lit_backend;
        }

        location ~ ^/assets/ {
            access_log off;
        }

        location ~ ^/spree/ {
            access_log off;
        }
    }
