Enable request streaming for a specific route rather than entire proxy

Not applicable

I only want to stream requests for a specific route within my proxy. I have set the request.streaming.enabled property within my HTTPProxyConnection, which enables streaming on all request. For some of my requests, I need to access the request payload. Is there a way I can enable streaming based a specific route?

Background: I have one endpoint that needs to handle large request bodies.

I have tried setting it via a js policy within the PreFlow request, but it does not seem to work.

My HTTPProxyConnection looks like:

    <HTTPProxyConnection>
        <BasePath>example/base/path</BasePath>
        <Properties>
            <Property name="allow.POST.without.content.length">true</Property>
            <Property name="request.streaming.enabled">true</Property>
        </Properties>
        <VirtualHost>default</VirtualHost>
        <VirtualHost>secure</VirtualHost>
        <VirtualHost>https_vhost</VirtualHost>
    </HTTPProxyConnection>
Solved Solved
0 4 438
2 ACCEPTED SOLUTIONS

Hi @Erik Taheri, I am not sure if it is possible to only enable streaming for specific routes.

Since you are talking about Request Streaming, maybe we can use multiple Proxy Endpoints and add the streaming specific route to one of the Proxy Endpoint with streaming property enabled. (In this case there will be two basepaths, one per ProxyEndpoint)

I haven't tried this, so I am adding this as a comment. Give it a shot & check.

View solution in original post

No.

You can use different ProxyEndpoints within a proxy bundle, and set streaming differently on those endpoints. The endpoints must be distinguished by a basepath.

For example, in endpoint1:

   <HTTPProxyConnection>
        <BasePath>example/base/path</BasePath>
        <Properties>
            <Property name="request.streaming.enabled">false</Property>
        </Properties>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>

and in endpoint 2:

   <HTTPProxyConnection>
        <BasePath>example/base/path/streaming</BasePath>
        <Properties>
            <Property name="request.streaming.enabled">true</Property>
        </Properties>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>

A request to https://server/example/base/path would not employ streaming

A request to https://server/example/base/path/streaming would employ streaming.

View solution in original post

4 REPLIES 4

Hi @Erik Taheri, I am not sure if it is possible to only enable streaming for specific routes.

Since you are talking about Request Streaming, maybe we can use multiple Proxy Endpoints and add the streaming specific route to one of the Proxy Endpoint with streaming property enabled. (In this case there will be two basepaths, one per ProxyEndpoint)

I haven't tried this, so I am adding this as a comment. Give it a shot & check.

Thanks, the crux of the issue was getting a large file to s3. I have decided to proceed by handling the media directly with s3.

No.

You can use different ProxyEndpoints within a proxy bundle, and set streaming differently on those endpoints. The endpoints must be distinguished by a basepath.

For example, in endpoint1:

   <HTTPProxyConnection>
        <BasePath>example/base/path</BasePath>
        <Properties>
            <Property name="request.streaming.enabled">false</Property>
        </Properties>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>

and in endpoint 2:

   <HTTPProxyConnection>
        <BasePath>example/base/path/streaming</BasePath>
        <Properties>
            <Property name="request.streaming.enabled">true</Property>
        </Properties>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>

A request to https://server/example/base/path would not employ streaming

A request to https://server/example/base/path/streaming would employ streaming.

Thanks, I will keep this in mind for future endpoints. I have decided to handle the request directly with s3 for this particual situation.