Routing APIs through HTTP-Headers

In Membrane, you can direct incoming requests to your API using the expression test property. In this case the expression will extract a header version to decide which content should be returned.

Ingredients

Configuration

<api port="2000" test="params.version matches '2024.1'">
    <template>
        Version 2024.1
    </template>
    <return />
</api>

<api port="2000" test="params.version matches '2024.2'">
    <template>
        Version 2024.2
    </template>
    <return />
</api>