Answer the question
In order to leave comments, you need to log in
How to implement content injection in mikrotik?
There is a Mikrotic router, users connect to it via wi-fi. It is required to show an advertising message on the pages viewed.
This problem was solved on some other routers. The scheme looked like this: The
dd-wrt firmware is installed, the router sends all http traffic to the proxy server (squid or Privoxy), which is installed (either on vpn, or on the local server, or) on the router itself. Proxy, in turn, looks for <head>
and replaces it with <head><script>.....</script>
and gives back the already changed page to the user. Thus, js code (Content (js) injection) is inserted on all pages of the user. And the display of the message is already customizable in js, which can be on any hosting.
The main idea is the ability to keep squid or Privoxy directly on the router (no vpn costs are required, just reflash / reconfigure the router).
Everything would be fine, but you can’t put dd-wrt on Mikrotic, and you don’t want to.
There was an article on the implementation on Habré, but there the idea was that Mikrotic turned all traffic to a remote proxy, and spending it is not an option.
I couldn’t figure it out in the documentation, on the Mikrotik proxy wiki ( wiki.mikrotik.com/wiki/Manual:IP/Proxy ) there are the following parameters:
rx-header - receiving HTTP header
tx-body - transmitting HTTP body to the client
tx-eof - writing chunk-end (when converting to chunked response)
tx-header - transmitting HTTP header to the client
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question