Unreleased changes are available as avenga/couper:edge
container.
Couper 1.9 is a feature release bringing more comfort and enhanced stability to the Couper configuration. It also improves the permission handling and provides a couple of bug fixes. For a complete list of changes see below.
As of release 1.9 it is possible to split a Couper configuration into multiple
.hcl
-files. You can now, for example, use different configuration files for
your api
, files
and definitions
blocks, or keep your development, testing
and production setups separated. All the configuration files given at
startup will be merged together.
The new block beta_health
(beta)
allows you to configure recurring health check requests for a backend.
By default, Couper won't request backends considered unhealthy which might help
them recover due to the reduced amount of requests.
The current health state of a backend can be accessed by variable.
Changes in healthiness will be logged and exported as metrics.
To make permission handling easier to grasp we've dropped the term scope
and
accordingly changed the names of the beta_scope
, beta_scope_claim
and beta_scope_map
attributes to beta_required_permission
, beta_permissions_claim
and beta_permissions_map
,
respectively. Furthermore, beta_required_permission
(formerly beta_scope
) can now
be an HCL expression. If beta_required_permission
is specified in both an endpoint
and its parent api
block, the former overrides the latter.
Our permission handling examples illustrate some common use cases:
basic example,
roles example,
map example
Along with this release goes the latest extension for VSCode which now indicates misplaced blocks and attributes, missing block labels and so on. We've also updated the completion suggestions and fixed a couple of syntax highlighting issues.
-
Added
- Couper now reads and merges multiple configuration files (#437, #515)
beta_health
-block tobackend
-block to enable continuous health-checks for defined backends (#313)backends.<name>.health
variable to access the current health-check state (subject to change)
- Log malformed duration settings (#487)
url
attribute could make use of our wildcard pattern/**
and relative urls in combination with a backend reference (#480)jwks_max_stale
injwt
block (#502)jwks_ttl
,jwks_max_stale
andconfiguration_max_stale
inoidc
block (#502)- Error handling for
backend
,backend_openapi_validation
andbackend_timeout
error types (#490) response.bytes
log-field to backend logs if read from body, fallback is theContent-Length
header (#494)- Error types
endpoint
andaccess_control
(#500)
-
Changed
- Permission handling: (#477, #504)
- renamed
beta_scope
attribute forapi
andendpoint
blocks tobeta_required_permission
;beta_required_permission
inendpoint
now overridingbeta_required_permission
in containingapi
block; allowing an expression as attribute value - renamed
beta_scope_claim
andbeta_scope_map
attributes forjwt
block tobeta_permissions_claim
andbeta_permissions_map
- removed
beta_operation_denied
andbeta_scope
error types - renamed
beta_insufficient_scope
error type tobeta_insufficient_permissions
- added
request.context.beta_required_permission
andrequest.context.beta_granted_permissions
request variables
- renamed
- Clarified the type of various attributes/variables (#485)
spa
block can be defined multiple times now (#510)files
block can be defined multiple times now (#513)
- Permission handling: (#477, #504)
-
Fixed
- Keys in object type attribute values are only handled case-insensitively if reasonable (e.g. they represent HTTP methods or header field values) (#461)
- Multiple labels for
error_handler
blocks (#462) error_handler
blocks for an error type defined in bothendpoint
andapi
(#469)- Request methods are treated case-insensitively when comparing them to methods in the
allowed_methods
attribute ofapi
orendpoint
blocks (#478) - Do not allow multiple
backend
blocks inproxy
andrequest
blocks (#483) - Panic if an
error_handler
block following anothererror_handler
block has no label (#486) - Spurious
duplicate endpoint /**
error for APIs sharing the same base path (#507) - Invalid (by OpenAPI validation) backend response missing in
backend_responses
(#501) - Ignore the
expected_status
check for a request configured via aproxy
orrequest
block if abackend
error occured (#505) merge()
function removes key withnull
value. (#518)
-
Removed
- support for
beta_oidc
block (useoidc
block instead) (#475) - support for
beta_oauth_authorization_url
andbeta_oauth_verifier
functions (useoauth2_authorization_url
andoauth2_verifier
functions instead) (#475) path
attribute fromendpoint
(andproxy
) block; usepath
attribute inbackend
block instead (#516)
- support for
- Fixed
- missing error handling while loading a given
ca_file
(#460) - allow
api
blocks sharing the samebase_path
(#471)
- missing error handling while loading a given
-
Added
disable_private_caching
attribute for the JWT Block (#418)backend_request
andbackend_response
variables (#430)beta_scope_map
attribute for the JWT Block (#434)saml
error type (#424)allowed_methods
attribute for the API or Endpoint Block (#444)- new HCL functions:
contains()
,join()
,keys()
,length()
,lookup()
,set_intersection()
,to_number()
(#455) ca_file
option tosettings
(also as argument and environment option) (#447)- Option for adding the given PEM encoded ca-certificate to the existing system certificate pool for all outgoing connections.
-
Changed
-
Fixed
- improved protection against sniffing using unauthorized requests with non-standard method to non-existent endpoints in protected API (#441)
- Couper handles OS-Signal
INT
in all cases in combination with the-watch
argument (#456) - some error types related to JWT (#438)
- Fixed
- Fixed
- missing upstream log field value for
request.proto
(#421) - handling of
for
loops in HCL (#426) - handling of conditionals in HCL: only predicates evaluating to boolean are allowed (#429)
- broken binary on macOS Monterey; build with latest go 1.17.6 (ci) (#439)
- missing upstream log field value for
We start 2022 with fresh release of Couper with some exciting features.
Our OpenID-Connect (OIDC) configuration specification has been proven as final and is moved out of beta to the oidc
block.
(Couper will still support beta_oidc
until version 1.8
). With OIDC, Couper supports a variety of Identity Provides such as Google, Azure AD, Keycloak and many more.
While microservices aim for decoupling, they still need to work together. A typical API gateway approach is to make them individually accessible and move the point of integration into the client. Couper sequences however allows you to chain requests in the gateway. The response of one service call is used as input for the request to the next service. This keeps coupling loose and inter-service connectivity robust. How Couper can help here is explained in our sequence example.
As part of our efforts to ease observability, Couper now allows you to collect custom log data. Use the custom_log_fields
attribute
all over your configuration file to augment your logs with information that is relevant to your application. Check out our example to find out how it works.
To further improve the developer experience with Couper the container image supports amd64
and arm64
architecture now.
On top of that the binary installation has been improved for homebrew users: brew tap avenga/couper && brew install couper
and go!
-
Added
- Support for sequences of outgoing endpoint requests (#405)
expected_status
attribute forrequest
andproxy
block definitions which can be caught with error handling (#405)custom_log_fields
attribute to be able to describe a user defined map forcustom
log field enrichment (#388)jwt
block/jwt_signing_profile
block support ECDSA signatures (#401)user
as context variable from a Basic Auth is now accessible viarequest.context.<label>.user
for successfully authenticated requests (#402)
-
Changed
oidc
block is out of beta. (Thebeta_oidc
block name will be removed with Couper 1.8. (#400)oauth2_authorization_url()
andoauth2_verifier()
functions are our of beta. (The old function namesbeta_oauth_...
will be removed with Couper 1.8). (#400)- The access control for the OIDC redirect endpoint (
oidc
block) now verifies ID token signatures (#404) header = "Authorization"
is now the default token source for JWT and may be omitted (#413)- Improved the validation for unique keys in all map-attributes in the config (#403)
- Missing scope or roles claims, or scope or roles claim with unsupported values are now ignored instead of causing an error (#380)
- Unbeta OIDC block. The old block name is still usable with Couper 1.7, but will no longer work with Couper 1.8. (#400)
- Unbeta the
oauth2_authorization_url()
andoauth2_verifier()
function. The prefix is changed frombeta_oauth_...
tooauth2_...
. The old function names are still usable with Couper 1.7, but will no longer work with Couper 1.8. (#400) - Automatically add the
private
directive to the responseCache-Control
HTTP header field value for all resources protected by JWT (#418)
-
Fixed
- build-date configuration for binary and docker builds (#396)
- exclude file descriptor limit startup-logs for Windows (#396, #383)
- possible race conditions while updating JWKS for the JWT access control (#398)
- panic while accessing primitive variables with a key (#377)
default()
function continues to the next fallback value if this is a string type and an argument evaluates to an empty string (#408)- missing read of client-request bodies if related variables are used in referenced access controls only (e.g. JWT token source) (#415)
-
Dependencies
- Update kin-openapi used for OpenAPI validation to
v0.83.0
(#399)
- Update kin-openapi used for OpenAPI validation to
-
Added
- Register
default
function ascoalesce
alias (#356) - New HCL function
relative_url()
(#361) - Log file descriptor limit at startup (#383)
error_handler
block support forapi
andendpoint
blocks (#317)- Enables reacting to additional error types:
beta_scope
,beta_insufficient_scope
andbeta_operation_denied
- Enables reacting to additional error types:
split()
andsubstr()
functions (#390)- hcl syntax verification for our configuration file (#296), (#168), (#188)
- validate against the schema and additional requirements
- available as
verify
command too
- Register
-
Changed
server
block label is now optional,api
block may be labelled (#358)- Timings in logs are now numeric values (#367)
-
Fixed
- Handling of
accept_forwarded_url
"host" ifH-Forwarded-Host
request header field contains a port (#360) - Setting
Vary
response header fields for CORS (#362) - Use of referenced backends in OAuth2 CC Blocks (#321)
- CORS preflight requests are not blocked by access controls anymore (#366)
- Reduced memory usage for backend response bodies which just get piped to the client and are not required to be read by Couper due to a variable references (#375)
- However, if a huge message body is passed and additionally referenced via e.g.
json_body
, Couper may require a lot of memory for storing the data structure.
- However, if a huge message body is passed and additionally referenced via e.g.
- For each SAML attribute listed in
array_attributes
at least an empty array is created inrequest.context.<label>.attributes.<name>
(#369) - HCL: Missing support for RelativeTraversalExpr, IndexExpr, UnaryOpExpr (#389)
- HCL: Missing support for different variable index key types (#391)
- OIDC: rejecting an ID token lacking an
aud
claim or with anull
valueaud
(#393)
- Handling of
-
Added
Accept: application/json
request header to the OAuth2 token request, in order to make the Github token endpoint respond with a JSON token response (#307)- Documentation of logs (#310)
signing_ttl
andsigning_key
/signing_key_file
tojwt
block for use withjwt_sign()
function (#309)jwks_url
andjwks_ttl
tojwt
block (#312)token_value
attribute injwt
block (#345)headers
attribute injwt_signing_profile
block (#329)
-
Changed
- Organized log format fields for uniform access and upstream log (#300)
claims
in ajwt
block are now evaluated per request, so thatrequest
properties can be used as required claim values (#314)- how Couper handles missing variables during context evaluation (#255)
- Previously missing elements results in evaluation errors and expressions like
set_response_headers
failed completely instead of one key/value pair. The evaluation has two steps now and will look up variables first and prepares the given expression to returnNil
as fallback.
- Previously missing elements results in evaluation errors and expressions like
-
Fixed
- Key for storing and reading OpenID configuration (#319)
-
beta_scope_claim
attribute tojwt
block;beta_scope
attribute toapi
andendpoint
blocks; error typesbeta_operation_denied
andbeta_insufficient_scope
(#315)beta_roles_claim
andbeta_roles_map
attributes tojwt
block (#325) (#338) (#352)- Metrics: Prometheus exporter (#295)
-
Dependencies
- build with go 1.17 (#331)
Release date: 2021-08-26
This release introduces Beta Features. We use beta features to develop and experiment with new, complex features for you while still being able to maintain our compatibility promise. You can see beta features as a feature preview. To make users aware that a beta feature is used their configuration items are prefixed with beta_
.
The first beta features incorporate the OAuth2 functionality into the Access Control capabilities of Couper. The beta_oauth2 {}
block implements OAuth2 Authorization Code Grant Flows. The companion block beta_oidc {}
implements OIDC, which allows simple integration of 3rd-party systems such as Google, Github or Keycloak for SSO (Single-Sign-On).
Together with transparent Websockets support that you can enable in your proxy {}
block, you can guard existing Web applications with Couper via OIDC.
To aid observability of your setups, Couper sends its request ID as the Couper-Request-Id
HTTP header in both backend requests and client responses. This makes it possible to trace events and correlate logs throughout the service chain. Couper can also accept a request ID generated by a downstream system like for example a load balancer. Like all settings, these can be configured in the config, as command line flag or via environment variables.
Load balancers or ingress services often provide X-Forwarded-Host
headers. Couper can be configured to use these to change the properties of the request
variable. This allows a Couper configuration to adapt to the run time environment, for example to create a back link for OIDC or SAML authorization requests with the request.origin
variable.
If your applications are running in multiple setups, like testing and production environments, there will likely be more parameters that you want to have configurable. Backend origins, user names, credentials, timeouts, all that could be nice to be changed without a new deployment. Couper supports using environment variables with env.VAR
-like expressions. Now, Couper can also provide default values for those variables. This makes it easy to have values configurable without the need to provide values outside of Couper (e.g. in Kubernetes). Our env vars example shows that in action.
-
Added
environment_variables
map in thedefaults
block to define default values for environment variables (#271)https-dev-proxy
option creates a TLS server listing on the given TLS port. Requests are forwarded to the givenserver
port. The certificate is generated on-the-fly. This function is intended for local development setups to support browser features requiring HTTPS connections, such as secure cookies. (#281)websockets
option inproxy
block enables transparent websocket support when proxying to upstream backends (#198)- Client request variables
request.url
,request.origin
,request.protocol
,request.host
andrequest.port
(#255) - Run option
-accept-forwarded-url
and settingaccept_forwarded_url
to acceptproto
,host
, orport
fromX-Forwarded-Proto
,X-Forwarded-Host
orX-Forwarded-Port
request headers (#255) - Couper sends its request ID as
Couper-Request-Id
HTTP header in backend requests and client responses. This can be configured with therequest_id_backend_header
andrequest_id_client_header
settings (#268) request_id_accept_from_header
setting configures Couper to use a downstream request ID instead of generating its own in order to help correlating log events across services (#268)couper.version
variable (#274)protocol
,host
,port
,origin
,body
,json_body
tobackend_requests
variable (#278)- Locking to avoid concurrent requests to renew OAuth2 Client Credentials access tokens (#270)
log-level
in thesettings
block to define when a log is printed (#306)
-
Changed
- The
sp_acs_url
in the SAML Block may now be relative (#265)
- The
-
Fixed
- No GZIP compression for small response bodies (#186)
- Missing error type for request/response body, json_body or form_body related HCL evaluation errors (#276)
request.url
andbackend_requests.<label>.url
now contain a query string if present (#278)backend_responses.<label>.status
is now integer (#278)backend_requests.<label>.form_body
was always empty (#278)- Documentation of
request.query.<name>
(#278) - Missing access log on some error cases (#267)
- Panic during backend origin / url usage with previous parse error (#206)
- Basic Auth did not work if only the
htpasswd_file
attribute was defined (#293) - Missing error handling for backend gzip header reads (#291)
- ResponseWriter fallback for possible statusCode 0 writes (#291)
- ResponseWriter buffer behaviour; prepared chunk writes (#301)
- Proper client-request canceling (#294)
-
- OAuth2 Authorization Code Grant Flow:
beta_oauth2 {}
block;beta_oauth_authorization_url()
andbeta_oauth_verifier()
(#247) - OIDC Authorization Code Grant Flow:
beta_oidc {}
block (#273)
- OAuth2 Authorization Code Grant Flow:
-
Changed
Error
log-level for upstream responses with status500
toInfo
log-level (#258)
-
Fixed
-
Added
-
Changed
-
Fixed
Release date: 2021-05-19
The most important feature of Couper 1.2 is the introduction of custom
error handling in form of the error_handler
block.
You can now register error handlers for error types. Instead of the standard error_file
template,
you can flexibly respond with arbitrary response
s. error_handler
is allowed in access control blocks (jwt
, saml2
…), where you
could e.g. handle missing tokens with a redirect-to-login. In the
future, error_handler
will be usable in more config areas. Refer to
the example
if you want to see it in action.
-
Added
-
Changed
-
Fixed
- Fix
/healthz
route when called withaccept-encoding: gzip
(#222) - Don't panic over duplicate access control definitions, log error instead (#221)
- Response for missing routes should have status code
404
(#224) - Fix possible race-condition with concurrent
openapi
validations (#231) - Fix use of server URLs without port in
openapi
(#230)
- Fix
Release date: 2021-04-21
- Fixed
- Endpoint responses are written and logged with correct status-code (#216)
- affected: a plain
response
without any additional headers or body configuration
- affected: a plain
- Endpoint responses are written and logged with correct status-code (#216)
Release date: 2021-04-16
-
Fixed
- allow more +json mime types (#207)
- determines if ja request/response body gets parsed and provided as
json_body
variable
- determines if ja request/response body gets parsed and provided as
- missing check for empty endpoint path patterns (#211)
- protected API (base)paths returns status 401 instead of 404 if a protected route was not found (#211)
- jwt source config definition (#210)
- missing inner context on context copy
- possible panic for unhandled error template write errors (#205)
- backend reference usage with string label (#189)
- cli argument filtering (#204)
- misleading jwt rsa key error (#203)
- watch handling on stat errors (#202)
- allow more +json mime types (#207)
-
Changed
- Change access control validation logging (#199)
- log the first occurred error instead of an array
- Change access control validation logging (#199)
-
Added
Release date: 2021-04-09
-
Added
couper help
and usage documentation (#187)
-
Changed
-
Fixed
- Fix missing
backend.origin
attribute url validation (#191)
- Fix missing
Release date: 2021-04-08
-
Fixed
- Log option for
json
formatted logs: (#176)- configured parent key applies to (almost) all log fields
- Log option for
-
Changed
- Change variable names to more user-friendly ones (#180):
req
->request
ctx
->context
bereq
-> removedberesp
-> removedbereqs
->backend_requests
beresps
->backend_responses
- Log option for parent fields are 'global' now (#176)
COUPER_ACCESS_LOG_PARENT_FIELD
,COUPER_BACKEND_LOG_PARENT_FIELD
->COUPER_LOG_PARENT_FIELD
- Change variable names to more user-friendly ones (#180):
-
Added
Release date: 2021-04-06
-
Fixed
- Some possible race conditions in combination with multiple
proxy
and/orrequest
definitions are fixed (#157) (#160) - Log endpoint related recovered panics
- CORS behaviour: result is now only dependent on the config, not the actual request; fixed Vary headers (#173)
- Fix json type assumption (#177)
- Fix missing string conversion for evaluated number values (#175)
- Loading optional labels of same type
- multiplexer behaviour with multiple servers and hosts (#161)
- Fix missing access_control for file handler (#169)
- 404 behaviour for access controlled endpoints: deny instead of 404 if the request matches the related base_path (#143)
- Some possible race conditions in combination with multiple
-
Changed
-
Added
- Add
json_body
attribute forrequest
andresponse
block (#158) bytes
log field to represent the body size
- Add
Release date: 2021-03-23
-
Fixed
-
Changed
backend
block attributesbasic_auth
,path_prefix
andproxy
hcl evaluation during runtimerequest
attributes hcl evaluation during runtime (#152)- Change configuration in combination with URL and backend.origin (#144)
request
andproxy
block can use theurl
attribute instead of define or reference abackend
- same applies to
oauth2.token_endpoint
- no
X-Forwarded-For
header enrichment from couperproxy
(#139) - more log context for access control related errors (#154)
-
Added
Release date: 2021-03-15
-
Fixed
- Fix missing panic recovering for backend roundtrips (#142)
- Fix backend
timeout
behaviour - Add a more specific error message for proxy body copy errors
- Fix backend
- Fix missing panic recovering for backend roundtrips (#142)
-
Changed
- Couper just passes the
X-Forwarded-For
header if any instead of adding the client remote addr to the list (#139)
- Couper just passes the
-
Added
url_encode
function for RFC 3986 string encoding (#136)
Release date: 2021-03-11
- Breaking Change
backend
will be consumed by proxy and request as transport configuration now. The previous behaviour thatbackend
represents aproxy
functionality is removed. Also thebackend
block must be defined indefinitions
,proxy
orrequest
.- Config migration, add a
proxy
block:
- Config migration, add a
endpoint "/old" {
backend = "reference"
# or
backend {
#...
}
}
# change to:
endpoint "/new" {
proxy {
backend = "reference"
}
# or
proxy {
backend {
#...
}
}
}
-
Changed
- Client-Request and upstream response body buffering by default
- Server shutdown delay and deadline defaults to
0s
now and can be configured via env if required - Websocket connection upgrades in combination with
proxy {}
are disabled- we will add a proxy option for ws usage later on
-
Fixed
- An absolute path resolving for
*_file
configuration attributes (#120)
- An absolute path resolving for
-
Added
-
Code Refactoring
- underlying code structure to represent an
endpoint
block withproxy
,request
andresponse
configuration - hcl evaluation context as own 'container' with
context.Context
interface - test cleanups
- underlying code structure to represent an
-
Dependencies
- build with go 1.16
- logrus to v1.8.1
- hcl to v2.9.1
- kin-openapi to v.0.49.0
Release date: 2021-02-16
-
Added
- backend:
- a user-friendly
basic_auth
option - backend
proxy
url,disable_connection_reuse
andhttp2
settings (#108)
- a user-friendly
- version command
- backend:
-
Changed
Release date: 2021-01-29
-
Fixed
- Fix missing http.Hijacker interface to be able to handle websocket upgrades (#80)
-
Added
-
Code Refactoring
- improved internals for configuration load
-
Dependencies
- Upgrade hcl to 2.8.2
- Upgrade go-cty module to 1.5.0
- Upgrade logrus module to 1.7.0
- Upgrade kin-openapi module to v0.37
Release date: 2021-01-19
- Fixed
Release date: 2021-01-18
- Fixed
Release date: 2021-01-13
-
Added
-
Fixed
- command flag filter for bool values (#85)
- different proxy options for same origin should be part of the origin transport key
-
Code Refactoring
- configuration load and prepare related body merges on hcl level
Release date: 2020-12-15
-
Added
-
Changed
-
Fixed
Release date: 2020-10-08
-
Added
-
Fixed
Release date: 2020-09-11
- Added
- Parse and load from given HCL configuration file
- Config structs for blocks:
server, api, endpoint, files, spa, definitions, jwt
- HTTP handler implementation for
api backends, files, spa
and related config mappings - CORS handling for
api
endpoints - Access control configuration for all blocks
- Access control type
jwt
with claim validation - Access und backend logs
- Configurable error templates with a fallback to our defaults
- Github actions for our continuous integration workflows
- Dockerfile
- Documentation