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

Difficulty level
Easy (less than an hour)
Version
current
Why the issue appeared?
Implementation mistake
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

cjeanneret triaged this task as Normal priority.
cjeanneret created this task.
cjeanneret changed Why the issue appeared? from Will be filled on close to Implementation mistake.

@cjeanneret Can you re-check it? And close it if all works fine.

erkin set Issue type to Bug (incorrect behavior).Aug 29 2021, 12:24 PM
erkin removed a subscriber: Active contributors.