Skip to content

Servers answer applications on plain HTTP instead of redirecting to HTTPS #342

Closed

Description

@samuelmbabhazi

What happens

An application deployed on a server answers on http:// with its content, instead of a redirect to https://. Seen with v0.1.0-alpha.3 (and the code has been the same since alpha.1) on a server installed with the command from the Servers page:

$ curl -s -o /dev/null -w '%{http_code}\n' --resolve hello.example.test:80:127.0.0.1 http://hello.example.test/
200

Why

EnsureServer (agent/internal/caddy/caddy.go) creates one Caddy server, shipkeep, that listens on both :80 and :443. Caddy's automatic HTTPS adds its HTTP-to-HTTPS redirect server only when no server already listens on the HTTP port. Here the Shipkeep server does, so every route is served on port 80 as well. Caddy still logs enabling automatic HTTP->HTTPS redirects, but the routes on :80 answer first.

The node's Caddy configuration after one deployment:

{"shipkeep": {"listen": [":80", ":443"], "routes": [{"@id": "sk-route-…", "match": [{"host": ["hello.example.test"]}], "handle": [{"handler": "reverse_proxy", "upstreams": [{"dial": "172.18.0.2:80"}]}], "terminal": true}]}}

Impact

Visitors who type the bare name, or follow an http:// link, use the application unencrypted. Cookies an application sets without Secure travel in clear text.

Expected

  • Port 80 serves only the ACME HTTP challenge and a redirect to HTTPS, for every Shipkeep route. Hosts listed by SetPlainHosts (automatic HTTPS skipped) keep being served on port 80.
  • Servers that already exist get the change when their agent is upgraded: EnsureServer updates the listen of an existing shipkeep server, without touching its routes.
  • A test that fails today: a route answered on :80 with a redirect, and on :443 with the application.

First noticed in the local end-to-end run of 12 November (follow-ups of #300), but never filed.

Activity

  1. added
    bug
    priority:P1
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P1securitytrack:agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions