Issue: I need to modify the response which is HTML. Need to inject data attribute into the response body.
The data attribute value would be the query param/post params.
Having Nginx as a webserver. How can we achieve this?
I checked already the nginx+lua. But is there any other approach? Also would SSI solve this problem? If yes then how can we get the query param and post value from nginx
You are exposing yourself to XSS attacks but it should be possible with the ngx_http_sub_module. To access query string parameter
foouse$arg_foo.So something like this:
If you call your site with
?foo=Helloit will replace##NAME##in your HTML withHello.In general however it's a terrible idea to let outside things (like querystring parameters) directly pass into your HTML!