Nice idea, I never had to do anything else personally than have zero-scaling but it sounds interesting.
Just one question, why not use a well established reverse-proxy and use or create a plugin? Treafik for instance has this: https://plugins.traefik.io/plugins/642498d26d4f66a5a8a59d25/...
Anyway, thank you for sharing!