Hydra on https getting mixed content


I’ve been trying to run Hydra on (let’s say) https://hydra.mysite.org. It all runs okay and I can connect to it, but I get mixed content errors as it tries to load some resources with http://hydra.mysite.org.

The way I have it set up is a reverse proxy which passes hydra.mysite.org to my homelab via a wireguard tunnel, where another Nginx reverse proxy processes it and sends the request to the corresponding port 3031 on localhost. I have to do it this way as I don’t have access to a public IP address.

My config is

services.hydra = {
	enable = true;
	hydraURL = "https://hydra.mysite.org"; # externally visible URL
	port = 3031;
	notificationSender = "hydra@localhost"; # e-mail of hydra service
	# a standalone hydra will require you to unset the buildMachinesFiles list to avoid using a nonexistent /etc/nix/machines
	buildMachinesFiles = [];
	# you will probably also want, otherwise everything will be built from scratch
	useSubstitutes = true;
services.nginx.virtualHosts = {
  "hydra.mysite.org" = {
		listen = [{
			addr = "";
		  	port = 3030;
  		locations."/" = {
      		proxyPass = "http://localhost:3031";
      		recommendedProxySettings = true;

Thanks for any help. (also the SSL encryption is taken care of at the first reverse proxy - on which I have no effect and can’t modify)

Hello! For anyone else who might come here from Google, I’ve had the same problem. You have to set X-Forwarded-Port header in virtual host config as it is not being set by the recommendedProxySettings option:

services.nginx.virtualHosts."hydra.mysite.org".locations."/".extraConfig = ''
  proxy_set_header X-Forwarded-Port 443;

See Catalyst documentation: