Add middleware to replicate nginx regexp rules