This configures accepting requests for b/ and cl/ on plain HTTP ports, and redirecting to b.tvl.fyi & cl.tvl.fyi appropriately. Additionally, Panettone request URIs that only contain decimals are redirected to `/issues/$request_uri` to enable issue short-links. This fixes b/32. Change-Id: I56954d8d69a3624267778b467520c509f4daa6c5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2908 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: sterni <sternenseemann@systemli.org>
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			683 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			683 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| { config, ... }:
 | |
| 
 | |
| {
 | |
|   imports = [
 | |
|     ./base.nix
 | |
|   ];
 | |
| 
 | |
|   config = {
 | |
|     services.nginx.virtualHosts."cl-shortlink" = {
 | |
|       serverName = "cl";
 | |
|       extraConfig = "return 302 https://cl.tvl.fyi$request_uri;";
 | |
|     };
 | |
| 
 | |
|     services.nginx.virtualHosts.gerrit = {
 | |
|       serverName = "cl.tvl.fyi";
 | |
|       serverAliases = [ "cl.tvl.su" ];
 | |
|       enableACME = true;
 | |
|       forceSSL = true;
 | |
| 
 | |
|       extraConfig = ''
 | |
|         location / {
 | |
|           proxy_pass http://localhost:4778;
 | |
|           proxy_set_header  X-Forwarded-For $remote_addr;
 | |
|           # The :443 suffix is a workaround for https://b.tvl.fyi/issues/88.
 | |
|           proxy_set_header  Host $host:443;
 | |
|         }
 | |
|       '';
 | |
|     };
 | |
|   };
 | |
| }
 |