Caddy Server Listening Port AIRVPN issue

I can’t seem to get the port forwarding through airvpn to work for caddy server. I know the server is functioning correctly because if I take the vpn down everything works. I’m using airvpn’s port forwarding, and I have used this correctly for plex, but I can’t seem to figure out how to change the listening port for caddy server (I think that’s the issue).

I’m forwarding port 2015 through air’s service and when it checks, it says that everything is working, but I still can’t access outside my home network.

Is there something I’m missing that I can put in the caddy file to change the listening port to the end port on air’s end? I believe it’s essentially working something like this: local port 2015 -----> airvpn port xxxxx basically, correct? So in a nutshell I need to tell caddy to listen to the final port that is at the end? That’s how I got plex to work outside my home network.

Hi @bobbarker,

After checking out AirVPN, it looks like what it does is hide your IP behind one of its own, updating DDNS to match your new IP, and forwards ports back to you - without translating them:

When you remotely forward a port, our servers will open that port (TCP, UDP or both, according to your selection) and will properly forward incoming packets to you on that port.

You provide Remote Port Forwarding, what is it? - AirVPN

So an open port 2015 on your AirVPN should connect to your device at home on port 2015.

As long as Caddy is listening on that port, it should respond to the request through AirVPN.

Thanks for the quick reply!

Unfortunately that doesn’t seem to be the case. Here is my caddy file: { I also tried neither worked.
tls off
proxy /sonarr {

proxy /radarr {

proxy /headphones {

So as soon as I turn off AIRVPN it works perfectly. I’m not sure why the port isn’t getting forwarded through?

One thing I did notice about AIRVPN and forwarding ports is that it says this:

Mapped to public IP:
Forwarded to: xx.4.7.xxxx

Obviously these addresses are different. I’m uncertain what is going on here. I have forwarded port 2015 through AIRVPN though and the system from AIRVPN claims that it is forwarded properly. I also forwarded the port through my router even though according to AIRVPN you don’t have to.

Any ideas?

You’re using the AirVPN client on your server, right?

If so, they’re correct - forwarding your modem ports is unnecessary. Your client connects out to their server, and they pass back connections that they receive on their public IP directly through that tunnel back to you, so you don’t need any ports open at all and you should never get connection requests on your WAN interface.

As for ideas… You said you can’t access /sonarr outside the network. Does that mean that works inside the network? And do Radarr and Headphones work inside/outside the network?

So a few days ago with that caddyfile I had everything working as soon as I turned off the VPN from inside or outside my network when I went to Now even without the VPN on I can’t seem to get it to come up from inside or outside the network, I can only pull it up by going to the internal ip on my home network of… I don’t believe that I changed anything and now I’m really at a loss. Before this the only problem I had was when AIRVPN was on, but now I can’t even get caddy to run properly with AIRVPN off.

When caddy starts it does say:
activating privacy features… done

Does that look right?

Also yes, AIRVPN is on the same computer as sonarr / radarr, caddy server etc.

Looks good to me.

But it seems like things are getting a little complicated because it looks like you’ve got a CNAME to a reverse proxy to a reverse proxy and I’m not 100% sure where all your domains are pointed. We should try to reduce the complexity as much as possible to get things working, then add complexity step by step to get our desired result.

The first step is to make sure Caddy’s working right. Lets make Caddy more permissive with regards to host, then try it out locally. Change the label of your Caddyfile to this:

:2015 {

Then, browse to Caddy locally at [hostname]:2015/sonarr, using the hostname/IP address of your Caddy server, and see if Sonarr pops up.

If that works, spin up AirVPN and try to access

If that works, try

Let me know where it breaks down, and what error you get.

Ok, so this is really weird but here it goes.

:2015 {
force quits caddy server.

If I take the VPN down and put
proxy /sonarr

it works from inside and outside my network at

Ok great, right?

Now if I put caddy server immediately shuts off and won’t stay running. The cmd window pops up says activating privacy features then immediately shuts down. I also tried running as administrator and got the same thing. I swapped out the two domains multiple times with the same exact effect. Caddy Server refuses to stay running with

Weird, right?

There’s almost certainly an error being printed but Windows is closing the cmd window before you have a chance to read it. You’ll want to open cmd and then type caddy -log stdout to run it and you will get full information this way.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.