argsort

package module
v0.0.0-...-3b65371 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

caddy-argsort

Build and test GoDoc Go Report Card

This is a caddy plugin. Works with caddy >= 2.8.0. Sort the request query arguments. Optionally case insensitive.

Usage

Simple usage

Once the order has been set in the global options block, use argsort in any server block

:8881 {
    header Content-Type "text/html; charset=utf-8"
    respond "Hello."
    argsort
}
Optional case insensitive usage

Once the order has been set in the global options block, use argsort lowecase in any server block

:8881 {
    header Content-Type "text/html; charset=utf-8"
    respond "Hello."
    argsort lowercase
}
Forward the normalized request to an upstream

Once the order has been set in the global options block, you ensure query arguments sorting for an upstream server

:8882 {
    argsort
    reverse_proxy localhost:8883
}

:8883 {
    header Content-Type "text/html; charset=utf-8"
    respond "Hello."
}

Documentation

Overview

Package argsort provides a Caddy module that optionally lowercase and then sort the query arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argsort

type Argsort struct {
	// Lowercase the query arguments before sorting them.
	Lowercase bool `json:"lowercase,omitempty"`
}

Argsort sort the query arguments after optionally lowercasing them.

Syntax:

argsort [lowercase]

func (Argsort) CaddyModule

func (Argsort) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Argsort) Provision

func (a *Argsort) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (Argsort) ServeHTTP

func (a Argsort) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*Argsort) UnmarshalCaddyfile

func (a *Argsort) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler. argsort [lower]

func (*Argsort) Validate

func (a *Argsort) Validate() error

Validate implements caddy.Validator.

Jump to

Keyboard shortcuts

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