
location /security {
    proxy_pass $scheme://$backend;

    proxy_no_cache 1;
    proxy_cache_bypass 1;

}

location /socket.io {
    set_by_lua_file $res ${NGX_LUA_DIR}/cuic_auth_header.lua;
    # Allow only those connections which are authenticated using websocket credentials.
    rewrite_by_lua_file /usr/local/openresty/nginx/lua/block_unauthorized_users.lua;

    # Set backend server where to route all the requests
    proxy_pass $scheme://$backend;
    proxy_http_version 1.1;

    # Required headers for a socket.io connection
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

location ~ ^/internaloptions/(.*)$ {
	internal;
	rewrite ^/internaloptions(?<realurl>/.*)$ $realurl break;
  	access_by_lua_file /usr/local/openresty/nginx/lua/checkcorsheaders.lua;
	proxy_pass $scheme://$backend;
	body_filter_by_lua_file  /usr/local/openresty/nginx/lua/cacheoptionsrequests.lua;
}