Airsonic with reverse proxy

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
graham
Posts: 1
Joined: Tue Jul 04, 2017 8:53 pm

Airsonic with reverse proxy

Post 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
User avatar
MichaIng
Site Admin
Posts: 2324
Joined: Sat Nov 18, 2017 6:21 pm

Re: Airsonic with reverse proxy

Post 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.
jason_a69
Posts: 11
Joined: Thu Apr 05, 2018 7:30 am

Re: Airsonic with reverse proxy

Post by jason_a69 »

Did you manage to get this going?
Milkman Dan
Posts: 16
Joined: Mon Apr 08, 2019 7:04 pm

Re: Airsonic with reverse proxy

Post 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
	}
}
Last edited by Milkman Dan on Tue Mar 03, 2020 4:30 am, edited 1 time in total.
jason_a69
Posts: 11
Joined: Thu Apr 05, 2018 7:30 am

Re: Airsonic with reverse proxy

Post 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
Post Reply