Opened 4 years ago

Closed 4 years ago

#1042 closed defect (invalid)

Lack of semicolon after "index index.html" isn't flagged as error but breaks redirect

Reported by: dandv@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.10.x
Keywords: Cc:
uname -a: Linux medcheck 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: # nginx -V
nginx version: nginx/1.10.1
built with OpenSSL 1.0.2g-fips 1 Mar 2016
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=/build/nginx-3I6R0c/nginx-1.10.1/debian/modules/nginx-auth-pam --add-module=/build/nginx-3I6R0c/nginx-1.10.1/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-3I6R0c/nginx-1.10.1/debian/modules/nginx-echo --add-module=/build/nginx-3I6R0c/nginx-1.10.1/debian/modules/nginx-upstream-fair --add-module=/build/nginx-3I6R0c/nginx-1.10.1/debian/modules/ngx_http_substitutions_filter_module

Description

I was following the Letsecure.me guide, using the "Final secured Nginx configuration".

By mistake, I omitted the ';' after "index index.html".

The problem is that sudo nginx -t && sudo nginx -s reload did not show any error, but the redirect returned an empty URI:

wget http://mydomain
[...]
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https:/// [following]
https:///: Invalid host name.

Change History (1)

comment:1 by Maxim Dounin, 4 years ago

Resolution: invalid
Status: newclosed

This is because the index directive can take multiple parameters, and omitted ';' after it doesn't make the syntax incorrect in most cases. Instead, the next directive in the configuration and its parameters are interpreted as additional index parameters.

Note: See TracTickets for help on using tickets.