Skip to content
MikroTik RouterOS Docs

Web Proxy

For the impatient: enable basic HTTP proxy.

# Enable proxy
/ip/proxy/set enabled=yes port=8080
# Block a website
/ip/proxy/access/add dst-host=*.facebook.com action=deny

For transparent proxy (no client configuration):

/ip/firewall/nat/add chain=dstnat protocol=tcp src-address=192.168.1.0/24 \
dst-port=80 action=redirect to-ports=8080

Verify with:

/ip/proxy/monitor

What this does: The Web Proxy caches HTTP content locally, reducing bandwidth usage and improving response times. It also enables content filtering by blocking websites, file types, or specific URLs.

When to use this:

  • Reducing bandwidth usage through HTTP caching
  • Blocking access to specific websites or content types
  • Implementing basic content filtering for a network
  • Relaying requests through an upstream (parent) proxy

Prerequisites:

  • Firewall rules to prevent open proxy abuse
  • For transparent proxy: NAT rules to redirect traffic
  • For disk caching: Formatted and mounted storage

HTTP Only

The MikroTik Web Proxy only handles HTTP traffic (port 80). HTTPS traffic cannot be transparently proxied. For HTTPS filtering, clients must explicitly configure the proxy in their browser settings.

Enable the proxy service:

/ip/proxy/set enabled=yes port=8080

Before anything else, prevent your proxy from being abused as an open proxy:

/ip/firewall/filter/add chain=input protocol=tcp dst-port=8080 \
src-address=192.168.1.0/24 action=accept comment="Allow LAN to proxy"
/ip/firewall/filter/add chain=input protocol=tcp dst-port=8080 \
action=drop comment="Block external proxy access"

For regular proxy mode, configure client browsers to use:

  • Proxy Address: Router IP (e.g., 192.168.1.1)
  • Port: 8080

Check proxy status:

/ip/proxy/monitor

Expected output:

status: running
uptime: 1h30m
requests: 1542
hits: 312
cache-used: 45.2MiB
total-ram-used: 52.1MiB
client-connections: 5
server-connections: 3

Redirect all HTTP traffic through the proxy automatically:

# Enable proxy
/ip/proxy/set enabled=yes port=8080
# Redirect HTTP traffic to proxy
/ip/firewall/nat/add chain=dstnat protocol=tcp \
src-address=192.168.1.0/24 dst-port=80 \
action=redirect to-ports=8080 comment="Transparent proxy"

Transparent proxy only works for HTTP (port 80). HTTPS traffic will bypass the proxy.

Block access to specific websites:

/ip/proxy/access/add dst-host=*.facebook.com action=deny
/ip/proxy/access/add dst-host=*.youtube.com action=deny
/ip/proxy/access/add dst-host=*.tiktok.com action=deny

Wildcard patterns:

  • * matches any characters
  • ? matches a single character
  • *.example.com matches all subdomains

Prevent downloading specific file types:

/ip/proxy/access/add path=*.exe action=deny comment="Block executables"
/ip/proxy/access/add path=*.mp3 action=deny comment="Block MP3s"
/ip/proxy/access/add path=*.torrent action=deny comment="Block torrents"
/ip/proxy/access/add path=*.zip action=deny comment="Block ZIP files"

Allow only specific sites:

/ip/proxy/access/add dst-host=*.company.com action=allow
/ip/proxy/access/add dst-host=*.microsoft.com action=allow
/ip/proxy/access/add dst-host=*.google.com action=allow
/ip/proxy/access/add action=deny comment="Block everything else"

Order matters: Rules are processed top-to-bottom; first match wins.

Store cache on disk instead of RAM:

# Check available disks
/disk/print
# Enable disk caching
/ip/proxy/set cache-on-disk=yes \
cache-path=/usb1/proxy-cache \
max-cache-size=1000000 \
max-cache-object-size=10240
  • max-cache-size: Total cache size in KiB (1000000 = ~1GB)
  • max-cache-object-size: Maximum single file size to cache in KiB

Route all requests through an upstream proxy:

/ip/proxy/set parent-proxy=10.0.0.1 parent-proxy-port=3128

Access local resources directly, not through parent proxy:

/ip/proxy/direct/add dst-address=192.168.0.0/16 action=allow
/ip/proxy/direct/add dst-address=10.0.0.0/8 action=allow
/ip/proxy/direct/add dst-host=*.local action=allow

Restrict specific clients:

# Block guest network from proxy
/ip/proxy/access/add src-address=192.168.2.0/24 action=deny
# Allow main network
/ip/proxy/access/add src-address=192.168.1.0/24 action=allow

Hide client IP addresses from destination servers:

/ip/proxy/set anonymous=yes

This suppresses the X-Forwarded-For header.

Prevent caching of dynamic/frequently-changing content:

/ip/proxy/cache/add dst-host=*.php action=deny
/ip/proxy/cache/add path=*cgi-bin* action=deny
/ip/proxy/cache/add path=*?* action=deny comment="Don't cache URLs with query strings"

Monitor current proxy connections:

/ip/proxy/connections/print

Shows source, destination, state, and bytes transferred.

List objects in cache:

/ip/proxy/cache-contents/print

Clear the cache:

/ip/proxy/cache-contents/remove [find]

Confirm the Web Proxy is working correctly:

/ip/proxy/print

Expected: enabled: yes with configured settings.

/ip/proxy/monitor

Expected: status: running, increasing requests count.

/ip/proxy/access/print

Expected: Rules listed in correct order.

/ip/proxy/monitor

Expected: hits count increasing (indicates caching is working).

/ip/proxy/connections/print

Expected: Active client/server connections during browsing.

SymptomCauseSolution
Proxy accessible from InternetNo firewall rulesAdd firewall rules to restrict access to LAN only
HTTPS sites not filteredHTTPS bypasses transparent proxyUse explicit proxy config on clients; transparent only works for HTTP
No cache hitsCache-Control headers or small object limitIncrease max-cache-object-size; try always-from-cache=yes
Disk cache not workingInvalid path or unmounted diskVerify disk with /disk/print; check path exists
Access rules not workingRule order incorrectFirst match wins; put specific rules before general rules
Some websites brokenSite detects/blocks proxyAdd to direct access list or use explicit proxy mode
High memory usageRAM-based cachingEnable cache-on-disk=yes with external storage
Clients can’t connectFirewall blocking proxy portAdd accept rule for proxy port from LAN
/log/print where topics~"proxy"

Use a specific client and check if rules match:

/ip/proxy/access/print stats

Shows hit counts per rule.

/ip/firewall/nat/print where action=redirect

Ensure the redirect rule is active and matching traffic.

Common Mistakes

  • Open proxy vulnerability - Always add firewall rules before enabling the proxy. An open proxy will be abused for spam and attacks.
  • Expecting HTTPS filtering - Transparent proxy only works for HTTP port 80. HTTPS requires explicit client configuration.
  • Wrong rule order - Access rules are processed top-to-bottom. Put specific rules before catch-all rules.
  • RAM exhaustion - Default RAM-based caching can exhaust memory. Use disk caching for large deployments.
  • Caching dynamic content - Don’t cache URLs with query strings or dynamic pages; create cache deny rules.

Access rules support various matching criteria:

PropertyMatchesExample
src-addressClient IP/subnet192.168.1.0/24
dst-addressServer IP/subnet10.0.0.0/8
dst-hostHostname pattern*.facebook.com
dst-portDestination port80 or 80-443
pathURL path pattern*.exe, */downloads/*
methodHTTP methodGET, POST, CONNECT
PatternMatches
*Any characters
?Single character
*.example.comAll subdomains of example.com
*facebook*Any URL containing “facebook”
:regexRegular expression (prefix with colon)
  • Files - disk management for caching
  • Resources - monitor cache disk usage
CommandDescription
/ip/proxy/setConfigure proxy settings
/ip/proxy/printView configuration
/ip/proxy/monitorReal-time statistics
/ip/proxy/access/addCreate access rule
/ip/proxy/access/printView access rules
/ip/proxy/direct/addCreate direct access rule
/ip/proxy/cache/addCreate cache control rule
/ip/proxy/connections/printView active connections
/ip/proxy/cache-contents/printView cached objects
PropertyTypeDefaultDescription
enabledyes/nonoEnable proxy service
portinteger8080Listening port
src-addressIP0.0.0.0Source address for outbound
anonymousyes/nonoHide client IP
cache-administratorstringwebmasterAdmin email for error pages
PropertyTypeDefaultDescription
cache-on-diskyes/nonoStore cache on disk
cache-pathstringweb-proxyDisk cache directory
max-cache-sizeKiBunlimitedMaximum total cache size
max-cache-object-sizeKiB2048Maximum single object size
max-fresh-timetime3dMaximum cache retention
always-from-cacheyes/nonoServe expired cache if unavailable
PropertyTypeDefaultDescription
parent-proxyIP0.0.0.0Upstream proxy address
parent-proxy-portinteger0Upstream proxy port
PropertyTypeDefaultDescription
max-client-connectionsinteger600Max client connections
max-server-connectionsinteger600Max server connections
FieldDescription
statusService status (running/stopped)
uptimeTime since proxy started
requestsTotal requests received
hitsRequests served from cache
cache-usedCurrent cache size
total-ram-usedRAM consumption
client-connectionsActive client connections
server-connectionsActive server connections