Created
July 27, 2021 23:13
-
-
Save nginx-gists/ecd6c9d12bc0f27c5d041cf1fbc94921 to your computer and use it in GitHub Desktop.
Announcing NGINX Plus R11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load_module modules/ngx_http_geoip2_module.so; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var method = "unknown"; | |
var client_messages = 0; | |
// Called by js_filter directive whenever a packet is processed in the TCP stream | |
function getSqlMethod(s) { | |
s.on('upload', function (data, flags) { | |
client_messages++; | |
if ( client_messages == 3 ) { // SQL query appears in 3rd client packet | |
var query_text = data.substr(1,10).toUpperCase(); | |
var methods = ["SELECT", "UPDATE", "INSERT", "SHOW", "CREATE", "DROP"]; | |
var i = 0; | |
for (; i < methods.length; i++ ) { | |
if ( query_text.search(methods[i]) > 0 ) { | |
s.log("SQL method: " + methods[i]); // To error_log [info] | |
method = methods[i]; | |
s.allow(); // Stop searching | |
} | |
} | |
} | |
s.allow(); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stream { | |
log_format custom '$remote_addr [$time_local] ' | |
'$protocol $status $bytes_sent $bytes_received ' | |
'$upstream_session_time $upstream_addr'; | |
#... | |
ssl_preread on; | |
# you can also use a more complex map{} to determine the target | |
proxy_pass $ssl_preread_server_name; | |
} | |
# vim: syntax=nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a discussion of these files, see Announcing NGINX Plus R11