caddyhttpabort

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 8 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

{
  servers {
    listener_wrappers {
      http_just_abort {
        respond "Custom content"
      }
      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 TLSAllowListenerWrapper

type TLSAllowListenerWrapper struct {
	Respond string `json:"respond,omitempty"`
	// contains filtered or unexported fields
}

TLSAllowListenerWrapper 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 (TLSAllowListenerWrapper) CaddyModule

func (TLSAllowListenerWrapper) CaddyModule() caddy.ModuleInfo

func (*TLSAllowListenerWrapper) Provision

func (h *TLSAllowListenerWrapper) Provision(ctx caddy.Context) error

func (*TLSAllowListenerWrapper) UnmarshalCaddyfile

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

func (*TLSAllowListenerWrapper) WrapListener

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

Jump to

Keyboard shortcuts

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