user  nginx;
worker_processes  1;

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

##### mandatory configuration for appsentinels start
load_module /etc/nginx/modules/nginx_ext_auth_module.so;
load_module /etc/nginx/modules/nginx_ext_access_log_module.so;
thread_pool ext_access_log_thread_pool threads=1 max_queue=65535;
###### mandatory configuration for appsentinels end

events {
}


http {
    server {
        listen       9000;
        server_name  front-service;
        
        # Appsentinels config block start
	ext_auth_fail_allow on;
	ext_access_log_api /nginxlog;
	ext_stats_server http://onprem-controller:9006;
	# External auth module location configuration
	location /auth {
  	    internal;
	    # AppSentinels Contoller where auth listening is present
            proxy_pass http://onprem-controller:9006;
        }
        # Appsentinels config block end

        location / {
	    # AppSentinels Configuration stanza [
            ext_auth_request /auth;
	    # ]
            proxy_http_version 1.1;
            proxy_set_header Connection "keep-alive";
            proxy_pass http://localhost:3000;
        }

	location /path1 {
	    # AppSentinels Configuration stanza [
            ext_auth_request /auth;
	    # ]
            proxy_http_version 1.1;
            proxy_set_header Connection "keep-alive";
            proxy_pass http://localhost:3001;
        }

	location /path2 {
	    # AppSentinels Configuration stanza [
            ext_auth_request /auth;
	    # ]
            proxy_http_version 1.1;
            proxy_set_header Connection "keep-alive";
            proxy_pass http://localhost:3002;
        }
    }
}

