Can I use caddy with IP address or bind host?

I look at the document and test it. Seem like Caddy work only in localhost.
How can I make it work with IP address or host?

I’m not certain what you’re asking. Please fill out the help thread template!

FYI you accidentally made a wiki article instead of a help post so you weren’t presented with the help thread template initially.

Just Caddy can not do api call or config outside of localhost.

Again, it’s unclear what you’re talking about. Please be more specific. The help thread template is there so that we can properly understand the common contextual questions that we need to properly answer your questions. Please fill it out.

1 Like

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

2. How I run Caddy:

Running “caddy start” from Administrator Command Prompt with Caddyfile below

a. System environment:
Ubuntu 20

b. Command:
Just install caddy and it automatically start

c. Service/unit/compose file:
N/A

d. My complete Caddyfile or JSON config:
Didn’t config anything yet

#3. The problem I’m having:
Ok to Run curl localhost:2019/config/
But want to able to run curl server_ip:2019/config/

#4. Error messages and/or full log output:
No error yet

#5. What I already tried:
I look at the document but it only mention about localhost

#6. Links to relevant resources:
https://caddyserver.com/docs/api-tutorial

1 Like

Hey @francislavoie
Thank you, I found the answer now at "Host not allowed" when calling the API remotely - #2 by WoJ

Sorry for mess the thing up.

1 Like

Ah - it wasn’t clear you were asking about Caddy’s admin API. Thanks for filling out the template!

Yeah, the default listen address is localhost:2019. You can change that to just :2019 to listen on all interfaces.

But note that if this is publicly accessible without some authentication layer, it opens you up to attackers to take over your server. So make sure it’s locked down.

One approach I’d recommend is to use ssh tunneling to connect to it instead, and continue to listen on localhost. Basically the ssh tunnel would bounce your request through to your server, secured by the ssh connection, then make the request look like it came from localhost, from the perspective of Caddy.

1 Like

Yes, will set it up. Just try it out for the time being

This topic was automatically closed after 30 days. New replies are no longer allowed.