Document updated on Feb 16, 2022
Log prefix | [SERVICE: HTTP Server] |
---|---|
Scope | service |
Source | luraproject/lura |
KrakenD starts an HTTP server to offer the API Gateway server. You can personalize some of the settings used to start the service and also override the default settings of the underlying Go standard library.
If you want to customize any of the settings below, they must be written at the top level of the configuration.
"false"
| Sets a default Cache-Control: public, max-age=%d header to all endpoints where %d is the conversion to seconds of any duration you write, indicating for how long the client (or CDN) can cache the content of the request. You can override this value per endpoint. Notice that KrakenD does not cache the content with this parameter, but tells the client how to do it. Defaults to 0s (no cache). For KrakenD cache, see backend caching.Specify units using ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), or h (hours).Defaults to "0s" |
| The maximum amount of time to wait for the next request when keep-alives are enabled. If idle_timeout is zero, the value of read_timeout is used. If both are zero, there is no timeout.Specify units using ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), or h (hours).Defaults to "0s" |
| The TCP port where KrakenD is listening to. Recommended value is in the range 1024-65535 to run as an unpriviliged user Defaults to 8080 |
| The amount of time allowed to read request headers. The connection’s read deadline is reset after reading the headers and the Handler can decide what is considered too slow for the body. Specify units using ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), or h (hours).Defaults to "0s" |
| Is the maximum duration for reading the entire request, including the body. Because read_timeout does not let Handlers make per-request decisions on each request body’s acceptable deadline or upload rate, most users will prefer to use read_header_timeout . It is valid to use them both.Specify units using ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), or h (hours).Defaults to "0s" |
| A sequential start registers all async agents in order, allowing you to have the starting logs in sequential order. A non-sequential start is much faster, but logs are harder to follow. Defaults to false |
| Maximum duration before timing out writes of the response. Specify units using ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), or h (hours).Defaults to "0s" |
When you declare in the configuration file any of the HTTP server settings declared above, you can override its value through environment variables when starting the server.
All the environment variables have the same name are the same settings above in uppercase and with the KRAKEND_
preffix. For instance, looking at the list of settings above, you could override:
KRAKEND_PORT
KRAKEND_READ_TIMEOUT
KRAKEND_READ_HEADER_TIMEOUT
KRAKEND_WRITE_TIMEOUT
KRAKEND_IDLE_TIMEOUT
You can start KrakenD with the desired variables to override what you have in the configuration:
$KRAKEND_PORT=8000 KRAKEND_READ_TIMEOUT="1s" krakend run -c krakend.json
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.