The only thing I have with Http is this for handling https/http traffic
#!ifdef WITH_WEBSOCKETS event_route[websocket:closed] { xlog("L_INFO", "WebSocket connection from $si:$sp has closed\n"); } #!endif
#!ifdef WITH_HTTP event_route[xhttp:request] { xlog("L_WARN", "HTTP Request Received on port $Rp\n");
#!ifdef WITH_WEBSOCKETS xlog("L_WARN", "[xhttp:request] Before into the 'Upgrade'\n"); if ( $hdr(Upgrade) =~ "websocket" && $hdr(Connection) =~ "Upgrade" && $rm =~ "GET" ) { xlog("L_WARN", "[xhttp:request] Inside the IF"); # Validate Host - make sure the client is using the correct # alias for WebSockets if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) { xlog("L_WARN", "Bad host $hdr(Host)\n"); xhttp_reply("403", "Forbidden", "", ""); exit; }
# Optional... validate Origin - make sure the client is from an # authorised website. For example, # # if ($hdr(Origin) != "https://example.com" # && $hdr(Origin) != "https://example.com") { # xlog("L_WARN", "Unauthorised client $hdr(Origin)\n"); # xhttp_reply("403", "Forbidden", "", ""); # exit; # }
# Optional... perform HTTP authentication
# ws_handle_handshake() exits (no further configuration file # processing of the request) when complete. if (ws_handle_handshake()) { # Optional... cache some information about the # successful connection exit; } } #!endif xhttp_reply("404", "Not Found", "", ""); } #!endif