V
V
Vitaliy2014-07-22 19:13:06
network hardware
Vitaliy, 2014-07-22 19:13:06

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

this suggests an idea, maybe you can somehow specify rx-header (< head>) and tx-header (< head>< script>.....</script>)
If everything is correct, you would know the syntax.
PS One non-verbose comment was found on the World Wide Web: "If your using MikroTik for your router it can do that its
in hotspot/user profiles"
, but the solution path should not change.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy, 2014-07-29
@bumajiuk

as it most often happens: figured it out myself:
solved with MetaRouter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question