[PR #5091] [infrastructure] caddy: remove explicit bind to port 80, to allow importing Caddyfile #27053

Open
opened 2026-08-05 07:08:09 -04:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/5091

State: closed
Merged: No


Describe your changes

Context
While trying out Netbird for the first time self-hosted for my homelab, I was auditing the installation script. I have a Caddy proxy already set up to do TLS termination for various subdomains and would like to install Netbird on the same VPS. However, don't want to run 2 instances of Caddy and the explicit bind to :80 prevented me from doing that.

Change 1 - Use checkip.amazonaws.com instead of jsonip.com
I felt this was more sustainable and reliable long term, and as a side effects obviates the need for jq.

Change 2 - Stop explicitly binding to port 80 in Caddy
Assuming the :80 bind is only to allow for automatic certificates, it is unnecessary in Caddy. But more importantly, this allows me to import the Caddyfile from my main Caddyfile. Specifying the port 80 bind prevents all my other domains from responding to ACME challenges.

This was easy enough for me to workaround on my own, but figured I'd contribute the change back upstream. Prost!

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Technically this changes removes the jq requirement for the install script. But I noticed some of the other installation scripts require it, so I think leaving the jq requirement documented is wise.

Summary by CodeRabbit

  • Chores
    • Streamlined setup scripts by removing jq dependency requirement
    • Updated external IP address detection to use AWS service
    • Refined Caddy web server configuration formatting and security headers

✏️ Tip: You can customize this high-level summary in your review settings.

**Original Pull Request:** https://github.com/netbirdio/netbird/pull/5091 **State:** closed **Merged:** No --- ## Describe your changes **Context** While trying out Netbird for the first time self-hosted for my homelab, I was auditing the installation script. I have a Caddy proxy already set up to do TLS termination for various subdomains and would like to install Netbird on the same VPS. _However_, don't want to run 2 instances of Caddy and the explicit bind to `:80` prevented me from doing that. **Change 1** - Use `checkip.amazonaws.com` instead of `jsonip.com` I felt this was more sustainable and reliable long term, and as a side effects obviates the need for `jq`. **Change 2** - Stop _explicitly_ binding to port 80 in Caddy Assuming the `:80` bind is _only_ to allow for automatic certificates, it is unnecessary in Caddy. But more importantly, this allows me to [import](https://caddyserver.com/docs/caddyfile/directives/import) the Caddyfile from my main Caddyfile. Specifying the port 80 bind prevents all my other domains from responding to ACME challenges. This was easy enough for me to workaround on my own, but figured I'd contribute the change back upstream. Prost! ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [X] Is a feature enhancement - [X] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [X] Documentation is **not needed** for this change (explain why) Technically this changes removes the jq requirement for the install script. But I noticed some of the other installation scripts require it, so I think leaving the `jq` requirement documented is wise. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Streamlined setup scripts by removing jq dependency requirement * Updated external IP address detection to use AWS service * Refined Caddy web server configuration formatting and security headers <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 07:08:09 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#27053