API Gateway: How to set the content-type in a Route via HTTP(S) assertion for use by backend.

book

Article ID: 142600

calendar_today

Updated On:

Products

CA API Gateway API SECURITY CA API Gateway Precision API Monitoring Module for API Gateway (Layer 7) CA API Gateway Enterprise Service Manager (Layer 7) STARTER PACK-7 CA Microgateway

Issue/Introduction

The API Gateway is sending an undesired content-type in the Route via HTTP(S) assertion to the backend, causing the request sent to the backend to fail. The backend is expecting a content-type of application/json (for example) and the Gateway is sending text/xml. This article will discuss how to set the desired content-type.

Cause

The Gateway will - by default - use the content-type specified in the request, which may not always be desirable by the backend.

Environment

This affects all supported Gateway versions.

Resolution

Various headers can be overwritten by using the Manage Transport Properties/Headers assertion.

The headers can be manipulated in the Route via HTTP(S) assertion too by following the instructions in the documentation here which walks through three different use-cases: https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-enterprise-software/layer7-api-management/api-gateway/9-4/policy-assertions/assertion-palette/message-routing-assertions/route-via-http-s-assertion.html#concept.dita_049ffc6cf73f4e1b368ebb8707b00fe50b5546cc_manipulating