Documentation
¶
Overview ¶
This is the filter_on_field plugin. It contains the code that implements the Traefik interfaces, and filters requests based on the parameters passed in the configuration, allowing all values except those that match the disallowed content.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// The name of the field to filter on
FieldName string `yaml:"fieldName" json:"fieldName" toml:"fieldName" redis:"fieldName"`
// The message to return when disallowed content is found. This is returned as the Error Response body.
ResponseMessage string `yaml:"responseMessage" json:"responseMessage" toml:"responseMessage" redis:"responseMessage"`
// A group of regular expressions representing content that is not allowed
DisallowedContent []string `yaml:"disallowedContent" json:"disallowedContent" toml:"disallowedContent" redis:"disallowedContent"`
}
A configuration struct for the filter. This is populated from the Traefik configuration, regardless of whether it's used via the dynamic configuration or the static configuration.
func CreateConfig ¶ added in v1.0.0
func CreateConfig() *Config
Create a default version of the configuration.
type FilterOnField ¶
type FilterOnField struct {
// contains filtered or unexported fields
}
The Filter On Field Struct that implements all of the Traefik interfaces in order to be used as a Traefik middleware plugin.
func (*FilterOnField) ServeHTTP ¶
func (f *FilterOnField) ServeHTTP(rw http.ResponseWriter, req *http.Request)
The ServeHTTP method is called by Traefik when a request is received. It takes a response writer and a request. When the checks pass, it calls the next handler in the chain. When the checks fail, it returns an error response.