Transposing Nginx sub-filters

New to HAProxy, is there an equivalent configuration for Nginx sub filters? The concept is to bring internal subdomain websites into an iframe and not allow the display of these sites outside of the iframe.

Current Nginx sub_filters:

sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?example.com)/) ) eval(event.data);}, false); if(window == top)top.location = "//example.com/#/welcome";</script>'; sub_filter_once on; sub_filter_types *;