Page 1 of 1

Airsonic with reverse proxy

Posted: Wed Sep 04, 2019 11:54 pm
by graham
How can I set up a reverse proxy to reach Airsonic via port 443 and letsencryt certificate via the internet.
As webserver I use lighttpd.
Webserver was installed with nextcloud via the standard script. Also ssl certificate and Airsonic.
Please give me some tips!
Thanks,
Juergen

Re: Airsonic with reverse proxy

Posted: Wed Sep 25, 2019 5:51 pm
by MichaIng
@graham
You might want to read the Lighttpd mod_proxy documentation about how to proxy a certain "url" to any other host:port: https://redmine.lighttpd.net/projects/l ... s_ModProxy
On the same machine it would be 127.0.0.1:<airsonic_port> then.

About HTTPS you have two possibilities:
- I would recommend, to keep it easy, to internally map the HTTPS request to Lighttpd to HTTP on Airsonic. There is this "https-remap" setting that allows to do that in both directions (HTTP => HTTPS backwards for Airsonic answers). But to be true I never tested it.
- Another possibility is to setup Airsonic with HTTPS as well, although it requires either an own HTTPS certificate then or access permissions to the ones, used by Lighttpd as well. But you need to check Airsonic docs then about how to set it up with HTTPS.

Re: Airsonic with reverse proxy

Posted: Sun Feb 23, 2020 4:59 pm
by jason_a69
Did you manage to get this going?

Re: Airsonic with reverse proxy

Posted: Tue Mar 03, 2020 4:04 am
by Milkman Dan
@jason_a69 I tried out Airsonic (and gave up on it because it used way too much memory for my tastes).

If you haven't already checked it out, I would recommend looking into caddyserver as a reverse proxy. It's easier to configure and its automatic SSL functionality is pretty slick. Only catch is sometimes you have to change the ports in other things that may be trying to listen in on ports 80 and 443.

Should you go down that route, there were two ways to go:
  1. Use the default config of the airsonic service with the path of /airsonic.
  2. Remove the path argument from the airsonic service (the -Dserver.context-path=/airsonic portion).
Option 1 was a stumper for me because I followed their config for caddy to the point (except for the conf file [virtual host] since I just use a singular Caddyfile) but it was wrong in a couple ways given the dietpi setup config. Going to <hostip>:<listeningport> won't work because it's set to /airsonic. If I put the proxy to /airsonic, I got an error about too many redirects.

I fixed that by using the following entry for my Caddyfile:

Code: Select all

mysubdomain.myhostname.com {
	proxy / <hostip>:<listeningport>/airsonic {
		transparent
			without /airsonic
	}
}
If you're not going to host any other websites, you can remove the path argument so that it's listening on just <hostip>:<listeningport>. That simplifies the entry in the Caddyfile a little bit:

Code: Select all

mysubdomain.myhostname.com {
	proxy / <hostip>:<listeningport> {
		transparent
	}
}

Re: Airsonic with reverse proxy

Posted: Tue Mar 03, 2020 4:16 am
by jason_a69
Hi Dan,

Thanks very much for this.

I also gave up on Airsonic because it was killing my Odroid C2 with its resource requirements.

I will keep this solution in mind if I go back to it.

Cheers

Jason