Thanks to the discussion in the comments on the blogpost written by Johan Björnfot I could simplify the code a lot and remove the HttpModule.

Version 3.0.0 is now available on the nuget feed.

It's a major version bump since I removed the HttpModule, you will need to remove the ContentApiModule entry in your web.config to make it work.

Remove the following entry

<system.webServer>  
  <modules>
    .....
    <add name="ContentApiModule" type="JOS.Epi.ContentApi.ContentApiModule, JOS.Epi.ContentApi" />
    ....
  </modules>    
</system.webServer>