traefik_compress

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

Local Mode

Traefik also offers a developer mode that can be used for temporary testing of plugins not hosted on GitHub. To use a plugin in local mode, the Traefik static configuration must define the module name (as is usual for Go packages) and a path to a Go workspace, which can be the local GOPATH or any directory.

The plugins must be placed in ./plugins-local directory, which should be in the working directory of the process running the Traefik binary. The source code of the plugin should be organized as follows:

 ├── docker-compose.yml
 └── plugins-local
    └── src
        └── github.com
            └── ghnexpress
                └── traefik-compress
                    ├── main.go
                    ├── vendor
                    ├── go.mod
                    └── ...

K8s

# cache-middleware.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  annotations: {}
  name: ghn-compress
  namespace: default
spec:
  plugin:
    plugin-compress:
      excludedContentTypes:
        - text/event-stream
      minResponseBodyBytes: 1024

Documentation

Index

Constants

View Source
const DefaultMinSize = 1024

DefaultMinSize is the default minimum size (in bytes) required to enable compression. See https://github.com/klauspost/compress/blob/9559b037e79ad673c71f6ef7c732c00949014cd2/gzhttp/compress.go#L47.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, conf Compress, name string) (http.Handler, error)

New creates a new compress middleware.

Types

type Compress

type Compress struct {
	// ExcludedContentTypes defines the list of content types to compare the Content-Type header of the incoming requests and responses before compressing.
	// `application/grpc` is always excluded.
	ExcludedContentTypes []string `` /* 127-byte string literal not displayed */
	// MinResponseBodyBytes defines the minimum amount of bytes a response body must have to be compressed.
	// Default: 1024.
	MinResponseBodyBytes int `` /* 127-byte string literal not displayed */
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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