Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oluwaseyeayinla/78724db24a2c54c14833b87b875f39c1 to your computer and use it in GitHub Desktop.
Save oluwaseyeayinla/78724db24a2c54c14833b87b875f39c1 to your computer and use it in GitHub Desktop.
Sample Advanced URL Rewrite JSON and YAML
{
"id": "624d73fe5623a70001293692",
"name": "REST Sample Advanced URL Rewrite Middleware #sample #middleware #rest",
"slug": "url-rewrite-demo",
"listen_port": 0,
"protocol": "",
"enable_proxy_protocol": false,
"api_id": "e5fd3eaa01d54f0377adc81872a21689",
"org_id": "653646c1d13bcc0001a557ff",
"use_keyless": true,
"use_oauth2": false,
"external_oauth": {
"enabled": false,
"providers": []
},
"use_openid": false,
"openid_options": {
"providers": [],
"segregate_by_client": false
},
"oauth_meta": {
"allowed_access_types": [],
"allowed_authorize_types": [],
"auth_login_redirect": ""
},
"auth": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"auth_configs": {
"authToken": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"basic": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"coprocess": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"hmac": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"jwt": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"oauth": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
},
"oidc": {
"name": "",
"use_param": false,
"param_name": "",
"use_cookie": false,
"cookie_name": "",
"disable_header": false,
"auth_header_name": "Authorization",
"use_certificate": false,
"validate_signature": false,
"signature": {
"algorithm": "",
"header": "",
"use_param": false,
"param_name": "",
"secret": "",
"allowed_clock_skew": 0,
"error_code": 0,
"error_message": ""
}
}
},
"use_basic_auth": false,
"basic_auth": {
"disable_caching": false,
"cache_ttl": 0,
"extract_from_body": false,
"body_user_regexp": "",
"body_password_regexp": ""
},
"use_mutual_tls_auth": false,
"client_certificates": [],
"upstream_certificates": {},
"pinned_public_keys": {},
"enable_jwt": false,
"use_standard_auth": false,
"use_go_plugin_auth": false,
"enable_coprocess_auth": false,
"custom_plugin_auth_enabled": false,
"jwt_signing_method": "hmac",
"jwt_source": "MDEyMzQ1Njc4OQ==",
"jwt_identity_base_field": "sub",
"jwt_client_base_field": "",
"jwt_policy_field_name": "pol",
"jwt_default_policies": [
"654b99d4d13bcc00014a3adb",
"654b9a32d13bcc00014a3ade"
],
"jwt_issued_at_validation_skew": 0,
"jwt_expires_at_validation_skew": 0,
"jwt_not_before_validation_skew": 0,
"jwt_skip_kid": false,
"scopes": {
"jwt": {},
"oidc": {}
},
"idp_client_id_mapping_disabled": false,
"jwt_scope_to_policy_mapping": {},
"jwt_scope_claim_name": "",
"notifications": {
"shared_secret": "",
"oauth_on_keychange_url": ""
},
"enable_signature_checking": false,
"hmac_allowed_clock_skew": -1,
"hmac_allowed_algorithms": [],
"request_signing": {
"is_enabled": false,
"secret": "",
"key_id": "",
"algorithm": "",
"header_list": [],
"certificate_id": "",
"signature_header": ""
},
"base_identity_provided_by": "",
"definition": {
"enabled": false,
"name": "",
"default": "",
"location": "header",
"key": "x-api-version",
"strip_path": false,
"strip_versioning_data": false,
"fallback_to_default": false,
"versions": {}
},
"version_data": {
"not_versioned": true,
"default_version": "2.0.0",
"versions": {
"2.0.0": {
"name": "2.0.0",
"expires": "",
"paths": {
"ignored": [],
"white_list": [],
"black_list": []
},
"use_extended_paths": true,
"extended_paths": {
"ignored": [
{
"disabled": false,
"path": "/not_found$",
"method": "",
"ignore_case": false,
"method_actions": {
"POST": {
"action": "reply",
"code": 404,
"data": "Advanced URl Rewrite - Not Found",
"headers": {}
}
}
}
],
"url_rewrites": [
{
"disabled": false,
"path": "/request_context_matches/jwt_claims",
"method": "POST",
"match_pattern": "/request_context_matches/jwt_claims",
"rewrite_to": "tyk://self/not_found",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {
"jwt_claims_sub": {
"match_rx": ".*",
"reverse": false
}
},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "tyk://self/anything/request_context/is_correct/$tyk_context.trigger-0-jwt_claims_sub"
}
]
},
{
"disabled": false,
"path": "/request_context_matches/ip_address",
"method": "POST",
"match_pattern": "/request_context_matches/ip_address",
"rewrite_to": "tyk://self/ip",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {
"remote_addr": {
"match_rx": "192.168.65.1",
"reverse": false
}
},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "http://httpbin.org/anything/query_val/is_correct/$tyk_context.trigger-0-remote_addr"
}
]
},
{
"disabled": false,
"path": "/query_val_matches/multiple_tiggers",
"method": "POST",
"match_pattern": "\\?([^\u0026=]+)=([^\u0026=]+)(?:\u0026([^\u0026=]+)=([^\u0026=]+))(?:\u0026([^\u0026=]+)=([^\u0026=]+))",
"rewrite_to": "tyk://self/anything/not_found?$1=$2\u0026$3=$4\u0026$5=$6",
"triggers": [
{
"on": "all",
"options": {
"header_matches": {},
"query_val_matches": {
"filter.id": {
"match_rx": "7",
"reverse": false
},
"filter.league.code": {
"match_rx": "Pac12Football",
"reverse": false
},
"filter.name": {
"match_rx": "test",
"reverse": false
}
},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/query_val_matches/Pac12Football/$1"
},
{
"on": "all",
"options": {
"header_matches": {},
"query_val_matches": {
"filter.id": {
"match_rx": "4",
"reverse": false
},
"filter.league.code": {
"match_rx": "NFL",
"reverse": false
},
"filter.name": {
"match_rx": "test",
"reverse": false
}
},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/query_val_matches/NFL/$1"
}
]
},
{
"disabled": false,
"path": "/header_matches/alphanumeric",
"method": "POST",
"match_pattern": "/header_matches/alphanumeric",
"rewrite_to": "/anything/fallback-header_matches",
"triggers": [
{
"on": "all",
"options": {
"header_matches": {
"Digits": {
"match_rx": "true",
"reverse": false
},
"Letters": {
"match_rx": "true",
"reverse": false
}
},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/header_matches/alpha_numeric/$1"
}
]
},
{
"disabled": false,
"path": "/path_part_matches/multiple",
"method": "POST",
"match_pattern": "/path_part_matches/multiple",
"rewrite_to": "tyk://self/not_found",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {
"pathpart": {
"match_rx": "foo(\\w+)",
"reverse": false
}
},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/path_part_matches/1st/$tyk_context.trigger-0-pathpart-0/2nd/$tyk_context.trigger-0-pathpart-1"
}
]
},
{
"disabled": false,
"path": "/query_val_matches/single",
"method": "POST",
"match_pattern": "/query_val_matches/single",
"rewrite_to": "tyk://self/not_found",
"triggers": [
{
"on": "all",
"options": {
"header_matches": {},
"query_val_matches": {
"x_test": {
"match_rx": "foo",
"reverse": false
}
},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/query_val/single/rewritten/$tyk_context.trigger-0-x_test-0"
}
]
},
{
"disabled": false,
"path": "/path_part_matches/single",
"method": "POST",
"match_pattern": "path_part_matches/single",
"rewrite_to": "tyk://self/not_found",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {
"pathpart": {
"match_rx": "foo",
"reverse": false
}
},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/path_part_matches/$tyk_context.trigger-0-pathpart-0"
}
]
},
{
"disabled": false,
"path": "/path_part_matches/group",
"method": "POST",
"match_pattern": "/path_part_matches/group",
"rewrite_to": "tyk://self/not_found",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {
"pathpart": {
"match_rx": "foo(\\w+)",
"reverse": false
}
},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/path_part_matches/sub-group/$tyk_context.trigger-0-pathpart-0-0/group/$tyk_context.trigger-0-pathpart-0"
}
]
},
{
"disabled": false,
"path": "/query_val_matches/demo",
"method": "POST",
"match_pattern": "/query_val_matches/demo",
"rewrite_to": "/anything/fallback-query_val_matches",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {
"character": {
"match_rx": "kronk",
"reverse": false
}
},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/disney?hero=$tyk_context.trigger-0-character-0"
},
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {
"character": {
"match_rx": "yzma",
"reverse": false
}
},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/disney?villain=$tyk_context.trigger-1-character-0"
},
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {
"character": {
"match_rx": "^$",
"reverse": false
}
},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/disney/error-no-category"
}
]
},
{
"disabled": false,
"path": "/header_matches/example",
"method": "POST",
"match_pattern": "/header_matches/example",
"rewrite_to": "/anything/header_matches/example/fallback_store-id",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {
"Store-Id": {
"match_rx": "1234",
"reverse": false
}
},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/header_matches/store-id/$tyk_context.trigger-0-Store-Id-0=localhost=$tyk_context.headers_Store_Id"
}
]
},
{
"disabled": false,
"path": "/payload_matches/demo",
"method": "POST",
"match_pattern": "anything/payload_matches",
"rewrite_to": "anything/fallback-payload_matches",
"triggers": [
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "(\\w+-*\\w*)",
"reverse": false
}
},
"rewrite_to": "/anything/payload_matches?value1=$tyk_context.trigger-0-payload-0\u0026value2=$tyk_context.trigger-0-payload-1\u0026value2=$tyk_context.trigger-0-payload-2\u0026value4=$tyk_context.trigger-0-payload-3\u0026value4=$tyk_context.trigger-0-payload-4\u0026value5=$tyk_context.trigger-0-payload-5\u0026value6=$tyk_context.trigger-0-payload-6\u0026value7=$tyk_context.trigger-0-payload-7\u0026value8=$tyk_context.trigger-0-payload-8\u0026value9=$tyk_context.trigger-0-payload-9"
},
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "\"test\"",
"reverse": false
}
},
"rewrite_to": "/anything/payload_matches?match=true\u0026value1=$tyk_context.trigger-1-payload-0"
},
{
"on": "any",
"options": {
"header_matches": {},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {},
"request_context_matches": {},
"payload_matches": {
"match_rx": "\"test\":\\s*\"([^\"]+)\"",
"reverse": false
}
},
"rewrite_to": "/anything/payload_matches?match=true\u0026value=$tyk_context.trigger-2-payload-0"
}
]
},
{
"disabled": false,
"path": "/header_matches/demo",
"method": "POST",
"match_pattern": "/header_matches/demo",
"rewrite_to": "/anything/fallback-header_matches",
"triggers": [
{
"on": "all",
"options": {
"header_matches": {
"X-Enable-Beta": {
"match_rx": "true",
"reverse": false
}
},
"query_val_matches": {},
"path_part_matches": {},
"session_meta_matches": {
"beta_enabled": {
"match_rx": "true",
"reverse": false
}
},
"request_context_matches": {},
"payload_matches": {
"match_rx": "",
"reverse": false
}
},
"rewrite_to": "/anything/header_matches/beta/$1"
}
]
}
],
"method_transforms": [
{
"disabled": false,
"path": "/ip$",
"method": "POST",
"to_method": "GET"
}
],
"track_endpoints": [
{
"disabled": false,
"path": "/ip$",
"method": "POST"
}
],
"persist_graphql": []
},
"global_headers": {},
"global_headers_remove": [],
"global_headers_disabled": false,
"global_response_headers": {},
"global_response_headers_remove": [],
"global_response_headers_disabled": false,
"ignore_endpoint_case": false,
"global_size_limit": 0,
"override_target": ""
}
}
},
"uptime_tests": {
"check_list": [],
"config": {
"expire_utime_after": 0,
"service_discovery": {
"use_discovery_service": false,
"query_endpoint": "",
"use_nested_query": false,
"parent_data_path": "",
"data_path": "",
"port_data_path": "",
"target_path": "",
"use_target_list": false,
"cache_disabled": false,
"cache_timeout": 60,
"endpoint_returns_list": false
},
"recheck_wait": 0
}
},
"proxy": {
"preserve_host_header": false,
"listen_path": "/mw/url_rewrite_adv/native/",
"target_url": "http://host.docker.internal:80",
"disable_strip_slash": false,
"strip_listen_path": true,
"enable_load_balancing": false,
"target_list": [],
"check_host_against_uptime_tests": false,
"service_discovery": {
"use_discovery_service": false,
"query_endpoint": "",
"use_nested_query": false,
"parent_data_path": "",
"data_path": "",
"port_data_path": "",
"target_path": "",
"use_target_list": false,
"cache_disabled": false,
"cache_timeout": 0,
"endpoint_returns_list": false
},
"transport": {
"ssl_insecure_skip_verify": false,
"ssl_ciphers": [],
"ssl_min_version": 0,
"ssl_max_version": 0,
"ssl_force_common_name_check": false,
"proxy_url": ""
}
},
"disable_rate_limit": false,
"disable_quota": false,
"custom_middleware": {
"pre": [],
"post": [],
"post_key_auth": [],
"auth_check": {
"disabled": false,
"name": "",
"path": "",
"require_session": false,
"raw_body_only": false
},
"response": [],
"driver": "",
"id_extractor": {
"disabled": false,
"extract_from": "",
"extract_with": "",
"extractor_config": {}
}
},
"custom_middleware_bundle": "",
"custom_middleware_bundle_disabled": false,
"cache_options": {
"cache_timeout": 60,
"enable_cache": false,
"cache_all_safe_requests": false,
"cache_response_codes": [],
"enable_upstream_cache_control": false,
"cache_control_ttl_header": "",
"cache_by_headers": []
},
"session_lifetime": 0,
"active": true,
"internal": false,
"auth_provider": {
"name": "",
"storage_engine": "",
"meta": {}
},
"session_provider": {
"name": "",
"storage_engine": "",
"meta": {}
},
"event_handlers": {
"events": {}
},
"enable_batch_request_support": false,
"enable_ip_whitelisting": false,
"allowed_ips": [],
"enable_ip_blacklisting": false,
"blacklisted_ips": [],
"dont_set_quota_on_create": false,
"expire_analytics_after": 0,
"response_processors": [],
"CORS": {
"enable": false,
"allowed_origins": [
"*"
],
"allowed_methods": [],
"allowed_headers": [
"Origin",
"Accept",
"Content-Type",
"X-Requested-With",
"Authorization"
],
"exposed_headers": [],
"allow_credentials": false,
"max_age": 24,
"options_passthrough": false,
"debug": false
},
"domain": "",
"certificates": [],
"do_not_track": false,
"enable_context_vars": true,
"config_data": {
"k8sName": "sample-url-rewrite-advanced",
"k8sNamespace": "default"
},
"config_data_disabled": false,
"tag_headers": [],
"global_rate_limit": {
"disabled": false,
"rate": 0,
"per": 0
},
"strip_auth_data": false,
"enable_detailed_recording": false,
"graphql": {
"enabled": false,
"execution_mode": "proxyOnly",
"version": "",
"schema": "",
"type_field_configurations": [],
"playground": {
"enabled": false,
"path": ""
},
"engine": {
"field_configs": [],
"data_sources": [],
"global_headers": []
},
"proxy": {
"auth_headers": {},
"request_headers": {},
"use_response_extensions": {
"on_error_forwarding": false
}
},
"subgraph": {
"sdl": ""
},
"supergraph": {
"subgraphs": [],
"merged_sdl": "",
"global_headers": {},
"disable_query_batching": false
},
"introspection": {
"disabled": false
}
},
"analytics_plugin": {},
"tags": [
"edge"
],
"detailed_tracing": false
}
apiVersion: tyk.tyk.io/v1alpha1
kind: ApiDefinition
metadata:
creationTimestamp: null
name: sample-url-rewrite-advanced
namespace: default
spec:
CORS:
allow_credentials: false
allowed_headers:
- Origin
- Accept
- Content-Type
- X-Requested-With
- Authorization
allowed_origins:
- "*"
debug: false
enable: false
max_age: 24
options_passthrough: false
active: true
api_id: e5fd3eaa01d54f0377adc81872a21689
auth:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
auth_configs:
authToken:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
basic:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
coprocess:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
hmac:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
jwt:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
oauth:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
oidc:
auth_header_name: Authorization
cookie_name: ""
param_name: ""
signature:
algorithm: ""
allowed_clock_skew: 0
error_code: 0
error_message: ""
header: ""
secret: ""
use_certificate: false
use_cookie: false
use_param: false
validate_signature: false
cache_options:
cache_all_safe_requests: false
cache_control_ttl_header: ""
cache_timeout: 60
enable_cache: false
enable_upstream_cache_control: false
config_data:
k8sName: sample-url-rewrite-advanced
k8sNamespace: default
custom_middleware:
auth_check:
name: ""
path: ""
raw_body_only: false
require_session: false
driver: ""
id_extractor:
extract_from: ""
extract_with: ""
extractor_config: {}
custom_middleware_bundle: ""
definition:
key: x-api-version
location: header
strip_path: false
disable_quota: false
disable_rate_limit: false
do_not_track: false
domain: ""
enable_context_vars: true
enable_coprocess_auth: false
enable_detailed_recording: false
enable_ip_blacklisting: false
enable_ip_whitelisting: false
enable_jwt: false
enable_proxy_protocol: false
global_rate_limit:
per: 0
rate: 0
graphql:
enabled: false
engine:
data_sources: []
field_configs: []
execution_mode: proxyOnly
playground:
enabled: false
path: ""
proxy:
auth_headers: {}
schema: ""
subgraph:
sdl: ""
supergraph:
disable_query_batching: false
merged_sdl: ""
id: 624d73fe5623a70001293692
internal: false
jwt_client_base_field: ""
jwt_default_policies:
- 654b99d4d13bcc00014a3adb
- 654b9a32d13bcc00014a3ade
jwt_identity_base_field: sub
jwt_policy_field_name: pol
jwt_scope_claim_name: ""
jwt_signing_method: hmac
jwt_skip_kid: false
jwt_source: MDEyMzQ1Njc4OQ==
listen_port: 0
name: "REST Sample Advanced URL Rewrite Middleware #sample #middleware #rest"
oauth_meta:
allowed_access_types: []
allowed_authorize_types: []
auth_login_redirect: ""
org_id: 653646c1d13bcc0001a557ff
protocol: ""
proxy:
check_host_against_uptime_tests: false
disable_strip_slash: false
enable_load_balancing: false
listen_path: /mw/url_rewrite_adv/native/
preserve_host_header: false
service_discovery:
cache_timeout: 0
data_path: ""
endpoint_returns_list: false
parent_data_path: ""
port_data_path: ""
query_endpoint: ""
target_path: ""
use_discovery_service: false
use_nested_query: false
use_target_list: false
strip_listen_path: true
target_url: http://host.docker.internal:80
transport:
proxy_url: ""
ssl_force_common_name_check: false
ssl_insecure_skip_verify: false
strip_auth_data: false
tags:
- edge
use_basic_auth: false
use_go_plugin_auth: false
use_keyless: true
use_mutual_tls_auth: false
use_oauth2: false
use_standard_auth: false
version_data:
default_version: 2.0.0
not_versioned: true
versions:
2.0.0:
expires: ""
extended_paths:
ignored:
- ignore_case: false
method_actions:
POST:
action: reply
code: 404
data: Advanced URl Rewrite - Not Found
headers: {}
path: /not_found$
method_transforms:
- method: POST
path: /ip$
to_method: GET
track_endpoints:
- method: POST
path: /ip$
url_rewrites:
- match_pattern: /request_context_matches/jwt_claims
method: POST
path: /request_context_matches/jwt_claims
rewrite_to: tyk://self/not_found
triggers:
- "on": any
options:
payload_matches:
match_rx: ""
reverse: false
request_context_matches:
jwt_claims_sub:
match_rx: .*
reverse: false
rewrite_to: tyk://self/anything/request_context/is_correct/$tyk_context.trigger-0-jwt_claims_sub
- match_pattern: /request_context_matches/ip_address
method: POST
path: /request_context_matches/ip_address
rewrite_to: tyk://self/ip
triggers:
- "on": any
options:
payload_matches:
match_rx: ""
reverse: false
request_context_matches:
remote_addr:
match_rx: 192.168.65.1
reverse: false
rewrite_to: http://httpbin.org/anything/query_val/is_correct/$tyk_context.trigger-0-remote_addr
- match_pattern: \?([^&=]+)=([^&=]+)(?:&([^&=]+)=([^&=]+))(?:&([^&=]+)=([^&=]+))
method: POST
path: /query_val_matches/multiple_tiggers
rewrite_to: tyk://self/anything/not_found?$1=$2&$3=$4&$5=$6
triggers:
- "on": all
options:
payload_matches:
match_rx: ""
reverse: false
query_val_matches:
filter.id:
match_rx: "7"
reverse: false
filter.league.code:
match_rx: Pac12Football
reverse: false
filter.name:
match_rx: test
reverse: false
rewrite_to: /anything/query_val_matches/Pac12Football/$1
- "on": all
options:
payload_matches:
match_rx: ""
reverse: false
query_val_matches:
filter.id:
match_rx: "4"
reverse: false
filter.league.code:
match_rx: NFL
reverse: false
filter.name:
match_rx: test
reverse: false
rewrite_to: /anything/query_val_matches/NFL/$1
- match_pattern: /header_matches/alphanumeric
method: POST
path: /header_matches/alphanumeric
rewrite_to: /anything/fallback-header_matches
triggers:
- "on": all
options:
header_matches:
Digits:
match_rx: "true"
reverse: false
Letters:
match_rx: "true"
reverse: false
payload_matches:
match_rx: ""
reverse: false
rewrite_to: /anything/header_matches/alpha_numeric/$1
- match_pattern: /query_val_matches/demo
method: POST
path: /query_val_matches/demo
rewrite_to: /anything/fallback-query_val_matches
triggers:
- "on": any
options:
payload_matches:
match_rx: ""
reverse: false
query_val_matches:
character:
match_rx: kronk
reverse: false
rewrite_to: /anything/disney?hero=$tyk_context.trigger-0-character-0
- "on": any
options:
payload_matches:
match_rx: ""
reverse: false
query_val_matches:
character:
match_rx: yzma
reverse: false
rewrite_to: /anything/disney?villain=$tyk_context.trigger-1-character-0
- "on": any
options:
payload_matches:
match_rx: ""
reverse: false
query_val_matches:
character:
match_rx: ^$
reverse: false
rewrite_to: /anything/disney/error-no-category
- match_pattern: /header_matches/example
method: POST
path: /header_matches/example
rewrite_to: /anything/header_matches/example/fallback_store-id
triggers:
- "on": any
options:
header_matches:
Store-Id:
match_rx: "1234"
reverse: false
payload_matches:
match_rx: ""
reverse: false
rewrite_to: /anything/header_matches/store-id/$tyk_context.trigger-0-Store-Id-0=localhost=$tyk_context.headers_Store_Id
- match_pattern: anything/payload_matches
method: POST
path: /payload_matches/demo
rewrite_to: anything/fallback-payload_matches
triggers:
- "on": any
options:
payload_matches:
match_rx: (\w+-*\w*)
reverse: false
rewrite_to: /anything/payload_matches?value1=$tyk_context.trigger-0-payload-0&value2=$tyk_context.trigger-0-payload-1&value2=$tyk_context.trigger-0-payload-2&value4=$tyk_context.trigger-0-payload-3&value4=$tyk_context.trigger-0-payload-4&value5=$tyk_context.trigger-0-payload-5&value6=$tyk_context.trigger-0-payload-6&value7=$tyk_context.trigger-0-payload-7&value8=$tyk_context.trigger-0-payload-8&value9=$tyk_context.trigger-0-payload-9
- "on": any
options:
payload_matches:
match_rx: '"test"'
reverse: false
rewrite_to: /anything/payload_matches?match=true&value1=$tyk_context.trigger-1-payload-0
- "on": any
options:
payload_matches:
match_rx: '"test":\s*"([^"]+)"'
reverse: false
rewrite_to: /anything/payload_matches?match=true&value=$tyk_context.trigger-2-payload-0
- match_pattern: /header_matches/demo
method: POST
path: /header_matches/demo
rewrite_to: /anything/fallback-header_matches
triggers:
- "on": all
options:
header_matches:
X-Enable-Beta:
match_rx: "true"
reverse: false
payload_matches:
match_rx: ""
reverse: false
session_meta_matches:
beta_enabled:
match_rx: "true"
reverse: false
rewrite_to: /anything/header_matches/beta/$1
ignore_endpoint_case: false
name: 2.0.0
override_target: ""
paths: {}
use_extended_paths: true
status:
api_id: ""
latestTransaction:
time: null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment