This page is about Caddy 1 and will go away soon because Caddy 2 is now available. Click here for Caddy 2.

User Guide

http.bind

bind overrides the host to which the server should bind. Normally, the listener binds to the wildcard host. However, you may force the listener to bind to another hostname or IP instead. This directive accepts only a host, not a port.

Note that binding sites inconsistently may result in unintended consequences. For example, if two sites on the same port resolve to 127.0.0.1 and only one of those sites is configured with bind 127.0.0.1, then only one site will be accessible since the other will bind to the port without a specific host; the OS will choose the more specific matching socket. (Virtual hosts are not shared across different listeners.)

Syntax

bind host

Examples

To make your socket accessible only to that machine, bind to IP 127.0.0.1 (localhost):

bind 127.0.0.1

Need help with this feature?

Join us in the Caddy forum, where the open source community gathers to share their knowledge.

Does your company use Caddy?

Purchase a commercial license to use Caddy with your business and for basic email support, along with other benefits!