I just refined this a bit:
https://github.com/discourse/discourse/commit/759803708077dc061ec4449395abb3505486e4fd
This gem was injecting extra middleware and adding stuff on our application controller. I changed it so it has no impact for users not using the feature.