In this post, i will share about How to setup web proxy server on MikroTik.
Before, what is Proxy server?
Proxy server is a server application that acts as an intermediary between a client requesting a resource and the server providing that resource.Wikipedia Proxy Server
Mainly, proxy server can be used for caching the static content so it can reduces the internet bandwidth usage. But sometimes, it also can be used for blocking website.
Please note :
- This tutorial limited for just only caching static content.
- If you have much clients, i recommend to use PC with >8GB RAM. But if you have small traffic, you can use MikroTik instead. In this post, i’m using MikroTik hAP ac^2 and only for personal use
1. Open IP > Web Proxy
2. Here is the web proxy. You must adjust it, depends on your network condition
- Src Address : Use 0.0.0.0
- Port : default is 8080. But i recommend to change the port to 3128
- Parent Proxy and Parent Proxy Port : remove
- Cache Administrator : keep it default or you can change it (it depends on you)
- Max Cache Size (allocating RAM for proxy) : keep unlimited or change the size (Suggested : For calculating how much allocation do you need : Your MikroTik or PC RAM – 200MB * 1024. It depends on your network condition)
- Max Cache Object Size : my recommendation change to 10240. But if you have larger RAM (same or more than 8GB, you can change to 51200)
- Cache On Disk (store cache to disk, not RAM) : My recommendation is to keep it off. Because storing cache on disk is slower for accessing the cache (except if you using SSD, but i still not recommend it)
- Max Client and Server Connections : keep it default or change it more than 600. If your network is always busy, my recommendation is change to 5000 both Client and Server
- Max Fresh Time : My recommendation, change to 300. Or if you have small traffic or just for personal use, keep it default
- Always From Cache : tick
Again, you must adjust the configuration
3. Go to IP > Firewall > NAT, and create NAT like this
General : Chain : dstnat > Protocol : tcp > Dst Port : 80
Action : redirect > to port : 3128
But you MUST block proxy connection from internet. Because, it will consume bandwidth (until gone wild) also your IP can be marked as abuse if someone from internet connect to your proxy server
Go to IP > Firewall > Filter, then create a rule
- Chain : input
- Dst Port : 3128
- In Interface : your WAN interface
- Action : drop
Now, you have set up your web proxy cache on your MikroTik router. Hope you enjoy my article!