Restricting allowed hosts
This article describes restricting allowed hosts for Portal instances that were deployed via Docker. If you used IIS, read this article instead.
Dataedo Portal, like any web application, receives the address it was called with in the HTTP Host header. By default, Portal accepts requests with any Host header value. This can be abused, for example to craft password reset links pointing to an attacker-controlled server, or to trick the application into building URLs to a malicious host.
You can safeguard against those attacks by configuring the list of host names. Requests with any other Host header will be rejected with 400 Bad Request before they reach the application.
Candidates for allowed hosts
To prevent issues with logging in from within your institution, the allowed hosts list should include every address used to reach Portal. Most common examples are:
- the public DNS name, e.g.
dataedo.example.com - the internal server name, if used, e.g.
dataedo-srv01 - the IP address, if users access Portal by IP
Rules for values
- if your list contains several addresses, separate each with a semicolon:
dataedo.example.com;dataedo-srv01 - do not include the scheme (
https://) or port — only the host name. Port numbers in incoming requests are ignored during matching. - wildcard subdomains are supported:
.example.commatchesdataedo.example.com, but notexample.comitself. - matching is case-insensitive.
If you omit a name that users rely on, their requests will start returning 400 Bad Request after you apply the change. Make sure the list is complete before restarting Portal.
Restricting allowed hosts via environment variable
During installation via Docker, set the AllowedHosts environment variable to the list of allowed hosts you compiled in the previous steps. It overrides the value from appsettings.json inside the container. See Docker environment variables for the full list.
If you run your own reverse proxy (nginx, Traefik, etc.) in front of Dataedo, additionally restrict the accepted host names there, so requests with unknown hosts are dropped at the edge.
Verifying the configuration
From any machine that can reach Portal, send a request with a forged Host header:
# should return 400 Bad Request
curl -k -H "Host: evil.example.org" https://dataedo.example.com/api/health
# should return 200 OK
curl -k https://dataedo.example.com/api/health
If the first request returns 400 Bad Request and the second works normally, host filtering is configured correctly.