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>
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			715 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			715 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
| { config, ... }:
 | |
| 
 | |
| {
 | |
|   imports = [
 | |
|     ./base.nix
 | |
|   ];
 | |
| 
 | |
|   config = {
 | |
|     services.nginx.virtualHosts."b-shortlink" = {
 | |
|       serverName = "b";
 | |
|       extraConfig = "return 302 https://b.tvl.fyi$request_uri;";
 | |
|     };
 | |
| 
 | |
|     services.nginx.virtualHosts."b.tvl.fyi" = {
 | |
|       serverName = "b.tvl.fyi";
 | |
|       serverAliases = [ "b.tvl.su" ];
 | |
|       enableACME = true;
 | |
|       forceSSL = true;
 | |
| 
 | |
|       extraConfig = ''
 | |
|         # Forward short links to issues to the issue itself (b/32)
 | |
|         location ~ ^/(\d+)$ {
 | |
|           return 302 https://b.tvl.fyi/issues$request_uri;
 | |
|         }
 | |
| 
 | |
|         location / {
 | |
|           proxy_pass http://localhost:${toString config.services.depot.panettone.port};
 | |
|         }
 | |
|       '';
 | |
|     };
 | |
|   };
 | |
| }
 |