caddyhttpabort

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

caddy-just-abort-http

Description

caddy-just-abort-http is a listener wrapper for Caddy that aborts incorrect HTTP requests sent to the TLS server.

This project is based on the code from caddyhttp/httpredirectlistener.go in the Caddy repository.

Usage

listener_wrappers {
	http_just_abort
	tls
}

See Also: https://caddyserver.com/docs/caddyfile/options#listener-wrappers

License

This project is licensed under the Apache License, Version 2.0.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPAbortListenerWrapper

type HTTPAbortListenerWrapper struct {
	Respond string `json:"respond,omitempty"`
}

HTTPAbortListenerWrapper provides HTTP->HTTPS redirects for connections that come on the TLS port as an HTTP request, by detecting using the first few bytes that it's not a TLS handshake, but instead an HTTP request.

This is especially useful when using a non-standard HTTPS port. A user may simply type the address in their browser without the https:// scheme, which would cause the browser to attempt the connection over HTTP, but this would cause a "Client sent an HTTP request to an HTTPS server" error response.

This listener wrapper must be placed BEFORE the "tls" listener wrapper, for it to work properly.

func (HTTPAbortListenerWrapper) CaddyModule

func (HTTPAbortListenerWrapper) CaddyModule() caddy.ModuleInfo

func (*HTTPAbortListenerWrapper) UnmarshalCaddyfile

func (h *HTTPAbortListenerWrapper) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

func (*HTTPAbortListenerWrapper) WrapListener

func (h *HTTPAbortListenerWrapper) WrapListener(l net.Listener) net.Listener

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL