# Ref: https://github.com/openresty/openresty/#resolvconf-parsing
resolver local=on;
# Need real ip address for flags in replay.
# Some LBs will forward real ips as x-forwarded-for
# So making that as priority
map $http_x_forwarded_for $real_ip {
    ~^(\d+\.\d+\.\d+\.\d+) $1;
    default $remote_addr;
}
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

server {
  listen 8080 default_server;
  # listen [::]:80 default_server;
  # server_name _;
  
  set_by_lua_block $api_endpoint {return os.getenv("API_ENDPOINT")}
  set_by_lua_block $frontend_endpoint {return os.getenv("FRONTEND_ENDPOINT")}

  include /etc/nginx/conf.d/location.list;
  client_max_body_size 10M;
}

