Search code examples
openwrt

Where in OPENWRT receives the http response of the requested website


I am currently looking into OPENWRT and want to know where in OPENWRT receives the web http response e.g. in GZIP or Deflat format?

So the user connects to the WIFI through the router installed OPENWRT. The user sends a request for e.g. example.com. When the example.com sends the http response in whatever format to the user, it must first arrive at the router and can be intercepted by OpenWRT. I want to know where OpenWRT does this job so i can make some manipulations to the web response before it arrives at the user's device


Solution

  • OpenWRT doesn't actually "intercept" web responses from arbitrary urls. It's default state is as a more pure router, which means that it largely operates on "network" layer traffic and below. "Web response[s]" are considered "application" layer. See this diagram of the network layer stack:

    Network layer stack

    What you can do is install a piece of software on the openwrt router which will inspect application layer information and make manipulations. You should know that this can significantly slow traffic on your router. Here's a list of available openWRT proxies:

    http://wiki.openwrt.org/doc/howto/proxy.overview

    Depending on what "manipulations" exactly you're trying to achieve, tinyproxy might work. Squid is a more full-featured option, but may slow down traffic too much and has the potential to crash routers without sufficient RAM.

    http://wiki.openwrt.org/doc/howto/proxy.tinyproxy

    https://www.google.com/search?q=openwrt+squid