Enabling HTTP Subscriptions with the GraphOS Router and an API Gateway

Enable HTTP multipart subscriptions when using an API gateway in front of the router


Learn how to configure an API gateway to support HTTP multipart subscriptions with the GraphOS Router.

Organizations can require their APIs—including the router—to be fronted by an API gateway. API gateways often aren't configured to support subscriptions over HTTP multipart: API gateways by default usually buffer HTTP responses, but subscriptions over HTTP multipart require multipart responses to be streamed, not buffered.

The rest of this article describes how to configure API gateways from different vendors to stream and not buffer HTTP responses, therefore supporting subscriptions over HTTP multipart.

Azure API Management (APIM)

By default, an HTTP API endpoint in APIM buffers each response from a downstream service, where the endpoint must receive all chunks of an HTTP response before it sends the response to the client.

To enable HTTP subscriptions, the forward-request policy on the backend must be updated with buffer-response="false". This configures the HTTP API endpoint to send the chunks of a response to the requesting client as they are received.

xml
1<policies>
2    <backend>
3        <forward-request http-version="2or1" buffer-response="false" />
4    </backend>
5</policies>

Google Apigee

By default, an HTTP API endpoint in Apigee buffers each response from a downstream service, where the endpoint must receive all chunks of an HTTP response before it sends the response to the client.

To enable HTTP subscriptions, the response.streaming.enabled property must be set to true in both your ProxyEndpoint and TargetEndpoint definitions in the proxy bundle. This configures the HTTP API endpoint to send the chunks of a response to the requesting client as they are received.

xml
1<TargetEndpoint name="default">
2  <HTTPTargetConnection>
3    <URL>http://mocktarget.apigee.net</URL>
4    <Properties>
5      <Property name="response.streaming.enabled">true</Property>
6    </Properties>
7  </HTTPTargetConnection>
8</TargetEndpoint>
xml
1<ProxyEndpoint name="default">
2  <HTTPProxyConnection>
3    <BasePath>/v1/weather</BasePath>
4    <Properties>
5      <Property name="response.streaming.enabled">true</Property>
6    </Properties>
7  </HTTPProxyConnection>
8</ProxyEndpoint>

Mulesoft

Flex Gateway

Streaming of HTTP multipart is supported out of the box with no additional configuration required.

Proxy (Mule 4, CloudHub 2.0)

Streaming of HTTP multipart isn't supported. Use Flex Gateway instead.

Kong

Streaming of HTTP multipart is supported out of the box with no additional configuration required.

AWS API Gateway

AWS API Gateway doesn't support streaming of HTTP data.

A possible workaround is to use a Lambda expression which does support streaming. To learn more, see AWS Lambda response streaming.

Feedback

Edit on GitHub

Forums