Skip to content

Commit

Permalink
nginx: remove OPTIONS requests from logs.
Browse files Browse the repository at this point in the history
* Avoids log OPTIONS requests in access logs.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Jan 28, 2020
1 parent 2bd8cb2 commit aa90dd5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

map "$request:$status:$body_bytes_sent" $loggable {
"OPTIONS / HTTP/1.0:200:0" 0;
default 1;
}
# Standard log format
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
Expand All @@ -42,7 +47,7 @@ http {
'$msec $request_time '
'$upstream_http_x_session_id $upstream_http_x_user_id';
access_log /var/log/nginx/access.log trace;
access_log /var/log/nginx/access.log main if=$loggable;
sendfile on;
tcp_nopush on;
Expand Down

0 comments on commit aa90dd5

Please sign in to comment.