netbirdio/netbird · error

OIDC requires TLS — use port 443

Error message

OIDC requires TLS — use port 443

What it means

Fires in blockOIDCOnPlainHTTP when a request reaches an OIDC-configured domain over plain HTTP. Most IdPs reject http:// redirect URIs, so the middleware fails fast with this explicit error instead of letting the user hit the IdP's opaque invalid_redirect_uri error later. The faulting input is the plain-HTTP request scheme against a domain whose schemes include OIDC.

Solutions

  1. Access the service over HTTPS (port 443) instead of plain HTTP
  2. Enable TLS termination for the domain (e.g. the proxy's ACME support) so OIDC redirect URIs are https://
  3. If OIDC is not intended for this domain, remove the OIDC scheme from its configuration
  4. Update the bookmark/URL used to reach the service to the https form
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/internal/auth/middleware.go:197 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/53059c08c41c039e. Report an issue: GitHub.

Appendix: source

Thrown at proxy/internal/auth/middleware.go:197

	return false
}

// blockOIDCOnPlainHTTP fails fast when an OIDC-configured domain is hit
// over plain HTTP. Most IdPs reject http:// redirect URIs, so surfacing
// the misconfiguration here yields a clearer error than the IdP's
// "invalid redirect_uri" round-trip.
func (mw *Middleware) blockOIDCOnPlainHTTP(w http.ResponseWriter, r *http.Request, config DomainConfig) bool {
	if !requestIsPlainHTTP(r) {
		return false
	}
	if !hasOIDCScheme(config.Schemes) {
		return false
	}
	mw.logger.WithFields(log.Fields{
		"host":   r.Host,
		"remote": r.RemoteAddr,
	}).Warn("OIDC scheme reached on plain HTTP path; rejecting with 400 — use port 443")
	http.Error(w, "OIDC requires TLS — use port 443", http.StatusBadRequest)
	return true
}

func (mw *Middleware) getDomainConfig(host string) (DomainConfig, bool) {
	mw.domainsMux.RLock()
	defer mw.domainsMux.RUnlock()
	config, exists := mw.domains[host]
	return config, exists
}

func setCapturedIDs(r *http.Request, config DomainConfig) {
	if cd := proxy.CapturedDataFromContext(r.Context()); cd != nil {
		cd.SetAccountID(config.AccountID)
		cd.SetServiceID(config.ServiceID)
	}
}

// checkIPRestrictions validates the client IP against the domain's IP restrictions.

View on GitHub (pinned to 93e97f4bf1)