Page MenuHomeVyOS Platform

Generated NGINX configuration is wrong for the redirection (http -> https)
Closed, ResolvedPublicBUG

Description

Hello there,

It seems the generated nginx configuration for the redirection (server listening on the TCP/80) is wrong:
it's using $server_name in the redirect, while this value is set to "_" (default vhost in nginx).
It should be using $host instead, since this variable will contain the actual Host header content (among other possibilities[1]).

Here's a simple way to prove it:
curl -I <my-vyos-router>
HTTP/1.1 301 Moved Permanently
Server: nginx/1.14.2
Date: Thu, 29 Oct 2020 10:58:48 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: https://_/ <- this is wrong.

I'll submit a patch soon with the correction.

Cheers,

C.

[1] http://nginx.org/en/docs/http/ngx_http_core_module.html#var_host

Details

Version
current
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)