Cache files with Mikrotik RouterOS, http requests

Lately i was playing with Spacewalk channel creating and repository synchronization and i faced a problem that i need to cache files so i can faster repeat my scenario.
Lucky for me this is build in feature in my Mikrotik router :)

The goal is to cache all files from only one client.

First thing i do is plug a flash drive into mikrotik router:
The flash drive needs to be formated
Open web interface, go to System -> Disks and click [Format Drive]:
Select ext3 file system and click [Start]:
Wait till you get 100 percentage. Click [Close]:
Edit disk name by clicking on it:
Set usb disk name to cache:
Go for "IP" -> "Web Proxy".
Set "Enable" checkbox!
Enable "Src. Address". It will automatically set value to ::
Set "Port" to 8080
Enter your email address in "Cache Administrator"
Set "Max. Cache Size" to unlimited to use entire disk space
Set "Max Cache Object Size" to 204800 wich stands for 2GB
Enable checkbox "Cache On Disk"
Manually write down cache/lost+found in "Cache path"
When all done. Hit Apply, wait 10 seconds till status is running:
Go for "IP" -> "Firewall". Open tab [NAT] and click [Add New]:
Set "Chain" to dstnat
Set "Src. Address" to your servers address you want to cache
Set "Protocol" to 6 (tcp)
Set "Dst. Port" to 80
Set "Action" to redirect
Set "To Ports" to 8080
Add a comment in "Comment" section:
Scroll back to top and hit [OK]:
Now you can do some http request with your server and see what happens.
Go for "IP" -> "Web Proxy" and look into [Cache Contents]:
There should be files:
Anyway if you want to modify or remove this future the open NAT page and click on redirect field ;)
Hit [Remove] button to delete this rule and keep your system clean:
And you can disable "Web Proxy" service by itself:
Happy routing ;)

No comments: