API1
and second policy to API2
and API3
, if you create a key with both policies, your user will have access to all three APIs, where API1
will have quotas and rate limits defined inside the first policy, and API2
, API3
will have shared quotas and rate limits defined inside the second policy.
Additionally you can now mix policies defined for the same API but having different path and methods access rules. For example you can have one policy which allows only access to /users
and a second policy giving user access to a /companies
path. If you create a key with both policies, their access rules will be merged, and user will get access to both paths. See Multiple APIs for single Key Requests.
Enable subscribing to multiple APIs with single key
option to enable this new flow. When enabled, developers will see the new API generation user interface, which allows users to request access to multiple Catalogs of the same type with a single key.
From an implementation point of view, Developer objects now have a Keys
attribute, which is the map where the key is a key
and the value is an array of policy IDs. The Subscriptions
field can be considered as deprecated, with retained backwards compatibility. We have added new set of Developer APIs to manage the keys, similar to the deprecated subscriptions APIs.
Other changes:
portal/templates/request_multi_key.html
, portal/templates/request_multi_key_success.html
apply_policies
array instead of for_plan
"users:read companies:write"
or similar, it is up to your imagination. OpenID supports it as well, but at the moment only if your OIDC provider can generate ID tokens in JWT format (which is very common this days).
See our JWT Scope docs for more details.
(request-target)
and all the headers of the request will be used for generating signature string.
If the request doesn’t contain a Date
header, middleware will add one as it is required according to above draft.
A new config option request_signing
can be added in an API Definition to enable/disable the request signing. It has following format:
hmac-sha1
hmac-sha256
hmac-sha384
hmac-sha512
python_version
.
POST /api/keys/{custom_key} {key-payload}
. This new API ensures that Keys from multiple orgs will not intersect, and it also works for multi-data center setups, and even Tyk SaaS.
NOTE: This feature is available by request. Please contact our sales team for details.See our Dashboard SSO documentation for more details.
Debugging
tab in the API designer which provides a “Postman” like HTTP client interface to simulate queries for the current API definition being edited.
You can even debug your virtual endpoints by dynamically modifying the code, sending the request via Debugger
and watching the virtual endpoint plugin logs.
See Debugging Tab for more information.
"enable_multi_org_users": true
.
/api
route).
http_server_options.cipher_suites
array option.SMTP
noauth.TLDR To get benefit or performance improvements ensure that you haveWe have thoroughly analyzed every part of our Gateway, and the results are astounding, up to 160% improvement, compared to our 2.6 release. Such a performance boost comes from various factors, such as optimizing our default configs, better HTTP connection re-use, optimization of the analytics processing pipeline, regexp caching, doing fewer queries to the database, and numerous small changes in each of the middleware we have. Our performance testing plan was focused on replicating our customer’s setup, and try not to optimize for “benchmarks”: so no supercomputers and no sub-millisecond inner DC latency. Instead, we were testing on average performance 2 CPU Linode machine, with 50ms latency between Tyk and upstream. For testing, we used the Tyk Gateway in Hybrid mode, with a default config, except for a single 2.7 change whereclose_connections
set tofalse
and setmax_idle_connections_per_host
according to our production perfomance guide
max_idle_connections_per_host
is set to 500, as apposed to 100 in 2.6. Test runner was using Locust framework and Boomer for load generation.
For a keyless API we were able to achieve 3.7K RPS (requests per second) for 2.7, while 2.6 showed about 2.5K RPS, which is a 47% improvement.
For protected APIs, when Tyk needs to track both rate limits and quotas, 2.7 shows around 3.1K RPS, while 2.6 shows around 1.2K RPS, which is 160% improvement!
In 2.7 we optimized the connection pool between Tyk and upstream, and previously max_idle_connections_per_host
option was capped to 100. In 2.7 you can set it to any value. max_idle_connections_per_host
by itself controls an amount of keep-alive connections between clients and Tyk. If you set this value too low, then Tyk will not re-use connections and will have to open a lot of new connections to your upstream. If you set this value too big, you may encounter issues with slow clients occupying your connection and you may reach OS limits. You can calculate the correct value using a straightforward formula: if latency between Tyk and Upstream is around 50ms, then a single connection can handle 1s / 50s = 20 requests. So if you plan to handle 2000 requests per second using Tyk, the size of your connection pool should be at least 2000 / 20 = 100. For example, on low-latency environments (like 5ms), a connection pool of 100 connections will be enough for 20k RPS.
To get the benefit of optimized connection pooling, ensure that close_connections
is set to false
, which enables keep-alive between Tyk and Upstream.
murmur32
algorithm. To set the custom algorithm, you need to set hash_key_function
to one of the following options:
murmur32
murmur64
murmur128
sha256
sha256
cryptographic key hashing algorithm, for cases when you are willing to sacrifice performance with additional security.
Performance wise, setting new key hashing algorithms can increase key hash length, as well as key length itself, so expect that your analytics data size to grow (but not that much, up to 10%). Additionally, if you set the sha256
algorithm, it will significantly slowdown Tyk, because cryptographic
functions are slow by design but very secure.
Technically wise, it is implemented by new key generation algorithms, which now embed additional metadata to the key itself, and if you are curious about the actual implementation details, feel free to check the following pull request.
Changing hashing algorithm is entirely backward compatible. All your existing keys will continue working with the old murmur32
hashing algorithm, and your new keys will use algorithm specified in Tyk config. Moreover, changing algorithms is also backward compatible, and Tyk will maintain keys multiple hashing algorithms without any issues.
group_id
field, and if it is specified, all permissions will be inherited from the specified group. SSO API has been updated to include group_id
field as well.
"allowance"
"rate"
per
value, and need to be set to the same value.
"per"
is the time period, in seconds.NOTE: if you don’t want to have organization level rate limiting, setSee the Keys section of the Tyk Gateway REST API Swagger doc for more details."rate"
or"per"
to zero, or don’t add them to your request.
"hash_keys":
to true
in tyk.conf
):
POST /keys/create
, POST /keys
and POST /keys/{keyName}
also return field "key_hash"
for future useGET /keys
get all (or per API) key hashes. You can disable this endpoint by using the new tyk.conf
setting enable_hashed_keys_listing
(set to false by default)GET /keys/{keyName}
was modified to be able to get a key by hash. You just need provide the key hash as a keyName
and call it with the new optional query parameter hashed=true
. So the new format is GET /keys/{keyName}?hashed=true"
DELETE /keys/{keyName}?hashed=true
extended_paths
in the following format:
GET /oauth/clients/{apiID}/{oauthClientId}/tokens
This endpoint allows you to retrieve a list of all current tokens and their expiry date issued for a provided API ID and OAuth-client ID in the following format. New endpoint will work only for newly created tokens:
oauth_token_expired_retain_period
which specifies the retain period for expired tokens stored in Redis. The value is in seconds, and the default value is 0
. Using the default value means expired tokens are never removed from Redis.
POST /oauth/clients/create
, the api_id
is now optional - these changes make the endpoint more generic. If you provide the api_id
it works the same as in previous releases. If you don’t provide the api_id
the request uses policy access rights and enumerates APIs from their setting in the newly created OAuth-client.
At the moment this changes not reflected on Dashboard UI yet, as we going to do major OAuth improvements in 2.7
security.pinned_public_keys
option, or via an API definition pinned_public_keys
field, using the following format:
key-id
you should set the ID returned after you upload the public key using the Certificate API. Additionally, you can just set path to public key, located on your server. You can specify multiple public keys by separating their IDs by a comma.
Note that only public keys in PEM format are supported.
If public keys are not provided by your upstream, you can extract them
by yourself using the following command:
openssl s_client -connect the.host.name:443 | openssl x509 -pubkey -nooutIf you already have a certificate, and just need to get its public key, you can do it using the following command:
openssl x509 -pubkey -noout -in cert.pemNote: Upstream certificates now also have wildcard domain support
This feature is experimental and can be used only if you compile Tyk yourself own usingIf you work with JSON you are probably aware of the popularjq
tag:go build --tags 'jq'
jq
command line JSON processor. For more details, see here https://stedolan.github.io/jq/
Now you can use the full power of its queries and transformations to transform requests, responses, headers and even context variables.
We have added two new plugins:
transform_jq
- for request transforms.transform_jq_response
- for response transforms{ "path": "<path>", "method": "<method>", "filter": "<content>" }
.body
- your current request body._tyk_context
- Tyk context variables. You can use it to access request headers as well.{ "body": <transformed-body>, "rewrite_headers": <set-or-add-headers>, "tyk_context": <set-or-add-context-vars> }
.
body
is required, while rewrite_headers
and tyk_context
are optional.
.body
- your current response body._tyk_context
- Tyk context variables. You can use it to access request headers as well.._tyk_response_headers
- Access to response headers{ "body": <transformed-body>, "rewrite_headers": <set-or-add-headers>}
.
body
is required, while rewrite_headers
is optional.
name
field like this: “Api name #category1 #category2”, e.g. categories just appended to the end of the name.
Added new API /api/apis/categories
to return list of all categories and belonging APIs.
"hash_keys":
to true
in tyk_analytics.conf
):
POST /keys/
also returns a new field key_hash
per each key in the listGET /apis/{apiId}/keys/{keyId}
supports query string parameter hashed=true
to get the key info via hashGET /apis/{apiId}/keys
returns keys hashesDELETE /apis/{apiId}/keys?hashed=true
can delete a key by its hash, but its functionality is disabled by default, unless you set enable_delete_key_by_hash
boolean option inside the Dashboard configuration file.POST /api/portal/requests
now has an optional "oauth_info"
field which identifies the OAuth key request.
Example of the OAuth key request:
"by_user"
- contains the ID of portal developer who is requesting OAuth access"for_plan"
- subscription ID"version"
- is expected to have the value "v2"
"oauth_info"
- simple structure which contains a field with comma-separated list of redirect URI for OAuth flow"oauth_info"
will be present in replies for endpoints GET /api/portal/requests/{id}
and GET /api/portal/requests
When this kind of OAuth key request gets approved when using endpoint PUT /api/portal/requests/approve/{id}
a new OAuth-client is generated for a developer specified in the specified "by_user"
field.
Example of OAuth key request approval reply:
"client_id"
and "secret"
are OAuth-client credentials used to request the get token (they are to be kept in secret)"policy_id"
- the subscription this OAuth-client provides access to"redirect_uri"
- with comma-separated list of redirect URI for OAuth flowGET /api/portal/developers
endpoint.The developer object will have new field -
"oauth_clients"
which will contain a mapping of subscription IDs to the list of OAuth clients that the developer requested and
was approved, i.e.:
GET /apis/oauth/{apiId}/{oauthClientId}/tokens
GET /apis/oauth/{oauthClientId}/tokens
when the API ID is unknown or OAuth-client provides access to several APIs_id
field to id
in List Key Requests_id
field when retrieving a list of key requests to id
.
See List Key Requests for more details.
/admin/sso
endpoint. For example:
config
field, with exactly same structure as Portal Config, except new override
boolean field.
If set, Catalog settings will override global ones.
At the moment the following options can be overriden: Key request fields
, Require key approval
and Redirect on key request
(with Redirect to
option as well).
SSLInsecureSkipVerify
to true
in the TIB configuration file.
BackEnd.UseSSL
and, optionally, BackEnd.SSLInsecureSkipVerify
.
redis_use_ssl
and redis_ssl_insecure_skip_verify
options.
redis_use_ssl
and redis_ssl_insecure_skip_verify
options.
"newrelic": {"app_name": "<app-id>", "license_key": "<key>"}
Docs
spec.version_data.default_version
Docs
http_server_options
setting:
skip_target_path_escaping
Docs
enable_key_logging
option.
Docs
http_server_options - ssl_ciphers
Docs
config_data
spec
object now has access to APIID
and OriginID
to reflect similar functionality of Coprocess plugins.portal_session_lifetime
config variable.
Docs
notifications_listen_port
option to configure the port used by WebSockets for real-time notifications.
Docs
collection_cap_enable
and collection_cap_max_size_bytes
options.
forward_analytics_to_pump
to true, which disables analytics processing by MDCB itself, and enables the forwarding of all data to Tyk Pump running inside your management environment.
SocialProvider
with the following options:
apply_policies
field to the Key definition, which is an string array of Policy IDs.
NOTE: The old key apply_policy_id is supported, but is now deprecated.We have updated the Dashboard Apply Policies section of the Add Key section.
global_rate_limit
which specifies a global API rate limit in the following format: {"rate": 10, "per": 1}
, similar to policies or keys.
The API rate limit is an aggregate value across all users, which works in parallel with user rate limits, but has higher priority.
Extended Dashboard API designer Rate Limiting and Quotas section in Core settings:
tag_headers
which specifies a string array of HTTP headers which can be extracted and turned to tags.
For example if you include X-Request-ID
header to tag_headers, for each incoming request it will include a x-request-id-<header_value>
tag to request an analytic record.
This functionality can be useful if you need to pass additional information from the request to the analytics, without enabling detailed logging, which records the full request and response objects.
We have added a new Tag headers section to the Dashboard API Designer Advanced tab.
sso_permission_defaults
in Dashboard config file. Docssso_custom_login_url
and sso_custom_portal_login_url
Dashboard config options to enable users login using a custom SSO login page. DocsTyk/$VERSION
.
x-tyk-api-expires
date header for versioned APIsx-tyk-api-expires
header with expiry date.
Docs
control_api_port
option in configuration file, you can run the admin control api on a separate port, and hide it behind firewall if needed.
Docs
tyk lint
command which will validate your tyk.conf
file and validate it for syntax correctness, misspelled attribute names or format of values. The Syntax can be:
tyk lint
or tyk --conf=path lint
If --conf
is not used, the first of the following paths to exist is used:
./tyk.conf
/etc/tyk/tyk.conf
Docs
log_level
configuration variable to tyk.conf
to control logging level.
Possible values are: debug
, info
, warn
, error
Docs
jsonMarshal
helper to the body transform templates. You can apply jsonMarshal on a string in order to perform JSON style character escaping, and on complex objects to serialise them to a JSON string.
Example: {{ .myField | jsonMarshal }}
Docs
?block=true
argument to the /tyk/reload
API endpoint, which will block a response, until the reload is performed. This can be useful in scripting environments like CI/CD workflows.
Docs
tyk_js_path
file now contains only user codejs/tyk.js
file used only for custom user code. It is recommended to delete this file, if you are not using it, or remove Tyk internal code from it. New releases do not ship this file by default.
sso_permission_defaults
in Dashboard config file.
Example:
sso_custom_login_url
, sso_custom_portal_login_url
.
Docs
/admin/sso
endpoint for custom integration. In fact, the same API is used by our own Tyk Identity Broker.
Docs
proxy.preserve_host_header
field when saved via the UI.NOTE: This release is fully compatible with the previous version, except that if you want to use new features, like Mutual TLS, you need to upgrade all the related components.Cloud users will be automatically upgraded to the new release. Hybrid users should follow the upgrade instructions here. Self-Managed users can download the new release packages from their usual repositories.
tyk.conf
can be used with the new version. If you would like to keep your v2.2 settings, please remember to backup your tyk.conf
file before upgrading as it will be overwritten during the upgrade process.
However, there are behavioral differences in a v2.3 cluster when hooked up to a Dashboard that can cause some odd behavior if the upgrade is not conducted in the right order.
Tyk v2.3 Gateways continuously talk to each other sharing load data, they also share information with the Dashboard regarding their current configuration. This chatter, if exposed to a v2.2 Gateway, can cause it go into a reload loop, which isn’t ideal. Because of this, the recommended upgrade procedure for a Tyk v2.2 system is:
Note for MDCB: If you are using MDCB and want to upgrade your Gateways to v2.3, you will also need to upgrade your MDCB to v1.2.0.2.
tyk.conf
file:
tyk.conf
will assume a secure installation as the feature must be explicitly disabled. This means, prior to starting your new Gateways, either disable the security feature, or add a public/private key pair to your tyk.conf
and tyk_analytics.conf
files:
tyk.conf
:
tyk_analytics.conf
: