Skip to content

Wrong host parameter value in VM Manager Console URL in reverse proxy setups #2604

@oltdaniel

Description

@oltdaniel

I'm using a reverse proxy in front of my Unraid server, which results in a failed VM Console connection due to the wrong host parameter value being used for the console URL. That URL is then used to open the console in a new window. A manual fix is currently required for making the connection working again, by fixing the host parameter.

Specific example

I'm using a reverse proxy with unraid.internal and the target of 10.10.10.10 as my Unraid server. Right now

  wrong: https://unraid.internal/plugins/dynamix.vm.manager/vnc.html?v=0000000000&resize=scale&autoconnect=true&host=10.10.10.10:443&port=&path=/wsproxy/5701/
correct: https://unraid.internal/plugins/dynamix.vm.manager/vnc.html?v=0000000000&resize=scale&autoconnect=true&host=unraid.internal:443&port=&path=/wsproxy/5701/

NOTE: I do not know how relevant the port itself is in the end, as I haven't seen an Unraid Webserver on a non-standard port yet. It is just included by default in the Host header (see below).

Other Reports

Relevant Code / Infos

The code that generates the URL in question:

$vmrcurl = autov('/plugins/dynamix.vm.manager/'.$protocol.'.html',true).'&autoconnect=true&host='._var($_SERVER,'HTTP_HOST');

Possible headers with priority in that order (from top to bottom):

  • Forwarded: Modern Standard for communicating the host from a reverse proxy or similar. See RFC 7239 or MDN Reference for details.
  • X-Forwarded-Host: Non-standard but common header to communicate the host via reverse proxy, see MDN Reference.
  • Host: The header used in the current function, ignoring reverse proxy specific headers, see MDN Reference.

NOTE: Would be willing to open a PR, but I'm not familiar with the codebase, nor do I have a development setup for unraid itself, so I'm refraining from doing so for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions