server {
	listen 80;
	#server_name taiko.example.com;
	
	location /taiko-web/ {
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header Host $server_name;
		proxy_pass http://127.0.0.1:34801;
	}
	
	location ~ ^/taiko-web/(assets/|songs/|src/|manifest.json$) {
		rewrite ^/taiko-web/(.*) /$1 break;
		root /srv/taiko-web/public;
		location ~ ^/taiko-web/songs/([0-9]+)/preview\.mp3$ {
			set $id $1;
			rewrite ^/taiko-web/(.*) /$1 break;
			try_files $uri /taiko-web/api/preview?id=$id;
		}
	}
	
	location /taiko-web/p2 {
		proxy_http_version 1.1;
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "Upgrade";
		proxy_pass http://127.0.0.1:34802;
	}
}
