Define a Routing policy (see picture routing_policy1 and picture routing_policy2) and try to run a curl with a header call 3SCALE_ENVIRONMENT and value= stock-staging.api.5.9.49.249.xip.io
Find below my service definition:
{ "proxy_config": { "id": 390, "version": 71, "environment": "sandbox", "content": { "id": 52, "account_id": 2, "name": "Stock API (v1.0)", "oneline_description": null, "description": "", "txt_api": null, "txt_support": null, "txt_features": null, "created_at": "2019-03-30T09:01:58Z", "updated_at": "2019-10-03T14:12:53Z", "logo_file_name": null, "logo_content_type": null, "logo_file_size": null, "state": "incomplete", "intentions_required": false, "draft_name": "", "infobar": null, "terms": null, "display_provider_keys": false, "credit_card_support_email": null, "buyers_manage_apps": true, "buyers_manage_keys": true, "custom_keys_enabled": true, "buyer_plan_change_permission": "request", "buyer_can_select_plan": false, "notification_settings": null, "default_application_plan_id": null, "default_service_plan_id": null, "default_end_user_plan_id": null, "end_user_registration_required": true, "tenant_id": 2, "system_name": "stock_api_1", "backend_version": "1", "mandatory_app_key": true, "buyer_key_regenerate_enabled": true, "support_email": "admin@3scale.5.9.49.249.xip.io", "referrer_filters_required": false, "deployment_option": "hosted", "kubernetes_service_link": null, "tech_support_email": null, "admin_support_email": null, "proxiable?": true, "backend_authentication_type": "service_token", "backend_authentication_value": "b01066cd9d481da2331acd8c2f674ff0d16c19088010b0468280ca18041e47de", "proxy": { "id": 52, "tenant_id": 2, "service_id": 52, "endpoint": "https://stock-prod.api.5.9.49.249.xip.io:443", "deployed_at": null, "api_backend": "https://echo-api.3scale.net:443", "auth_app_key": "app_key", "auth_app_id": "app_id", "auth_user_key": "user_key", "credentials_location": "query", "error_auth_failed": "Authentication failed", "error_auth_missing": "Authentication parameters missing", "created_at": "2019-03-30T09:01:59Z", "updated_at": "2019-10-03T14:12:53Z", "error_status_auth_failed": 403, "error_headers_auth_failed": "text/plain; charset=us-ascii", "error_status_auth_missing": 403, "error_headers_auth_missing": "text/plain; charset=us-ascii", "error_no_match": "No Mapping Rule matched", "error_status_no_match": 404, "error_headers_no_match": "text/plain; charset=us-ascii", "secret_token": "Shared_secret_sent_from_proxy_to_API_backend_3deae4d96ce8a527", "hostname_rewrite": "", "oauth_login_url": null, "sandbox_endpoint": "https://stock-staging.api.5.9.49.249.xip.io:443", "api_test_path": "/api/health", "api_test_success": true, "apicast_configuration_driven": true, "oidc_issuer_endpoint": null, "lock_version": 86, "authentication_method": "1", "oidc_issuer_type": null, "error_headers_limits_exceeded": "text/plain; charset=us-ascii", "error_status_limits_exceeded": 429, "error_limits_exceeded": "Usage limit exceeded", "staging_domain": "stock-staging.api.5.9.49.249.xip.io", "production_domain": "stock-prod.api.5.9.49.249.xip.io", "hostname_rewrite_for_sandbox": "echo-api.3scale.net", "endpoint_port": 443, "valid?": true, "service_backend_version": "1", "hosts": [ "stock-prod.api.5.9.49.249.xip.io", "stock-staging.api.5.9.49.249.xip.io" ], "backend": { "endpoint": "https://backend-3scale.5.9.49.249.xip.io", "host": "backend-3scale.5.9.49.249.xip.io" }, "policy_chain": [ { "name": "cors", "version": "builtin", "configuration": { "allow_origin": "*" } }, { "name": "routing", "version": "builtin", "configuration": { "rules": [ { "url": "http://echo.jsontest.com", "condition": { "combine_op": "and", "operations": [ { "op": "matches", "value": "stock-staging.api.5.9.49.249.xip.io", "value_type": "plain", "match": "header", "header_name": "3SCALE_ENVIRONMENT" } ] } } ] } }, { "name": "apicast", "version": "builtin", "configuration": {} } ], "proxy_rules": [ { "id": 233, "proxy_id": 52, "http_method": "GET", "pattern": "/api/health$", "metric_id": 242, "metric_system_name": "healthUsingGET", "delta": 1, "tenant_id": 2, "created_at": "2019-03-30T09:11:36Z", "updated_at": "2019-08-20T15:15:55Z", "redirect_url": null, "position": 1, "last": false, "parameters": [], "querystring_parameters": {} }, { "id": 234, "proxy_id": 52, "http_method": "GET", "pattern": "/api/stock$", "metric_id": 243, "metric_system_name": "getStockUsingGET_2", "delta": 1, "tenant_id": 2, "created_at": "2019-03-30T09:11:41Z", "updated_at": "2019-08-20T15:15:55Z", "redirect_url": null, "position": 2, "last": false, "parameters": [], "querystring_parameters": {} }, { "id": 235, "proxy_id": 52, "http_method": "GET", "pattern": "/api/stock/{storeid}$", "metric_id": 244, "metric_system_name": "getStockUsingGET_1", "delta": 1, "tenant_id": 2, "created_at": "2019-03-30T09:11:45Z", "updated_at": "2019-08-20T15:15:55Z", "redirect_url": null, "position": 3, "last": false, "parameters": [ "storeid" ], "querystring_parameters": {} }, { "id": 236, "proxy_id": 52, "http_method": "GET", "pattern": "/api/stock/{storeid}/{productid}$", "metric_id": 245, "metric_system_name": "getStockUsingGET", "delta": 1, "tenant_id": 2, "created_at": "2019-03-30T09:11:49Z", "updated_at": "2019-08-20T15:15:55Z", "redirect_url": null, "position": 4, "last": false, "parameters": [ "storeid", "productid" ], "querystring_parameters": {} }, { "id": 237, "proxy_id": 52, "http_method": "GET", "pattern": "/api/store$", "metric_id": 246, "metric_system_name": "getStoresUsingGET", "delta": 1, "tenant_id": 2, "created_at": "2019-03-30T09:11:52Z", "updated_at": "2019-08-20T15:15:55Z", "redirect_url": null, "position": 5, "last": false, "parameters": [], "querystring_parameters": {} }, { "id": 289, "proxy_id": 52, "http_method": "POST", "pattern": "/api/stock$", "metric_id": 297, "metric_system_name": "additem", "delta": 1, "tenant_id": 2, "created_at": "2019-08-20T15:13:09Z", "updated_at": "2019-08-20T15:15:55Z", "redirect_url": null, "position": 6, "last": false, "parameters": [], "querystring_parameters": {} } ] } } } }
Routing policy with a "Header" filter never match with the preconfigured in the policy value.