Although this may not help the original poster since this is an old topic, I came across this and was running into the same issue fewi pointed out:
Destination NAT is before output, so you can't destination NAT router originated traffic. Instead of two routers you could also use a server behind the router that detects proxy failure and uses the API to make configuration changes but I agree that you can't do it natively in one router.
Although I found a solution to this, so if anybody like me comes across this thread, you can have the check process scripted in the same box. You don't need a destination NAT rule to force the MikroTik's http request through the proxy, instead you can point /tool fetch to your proxy using the address, host, src-path and method arguments instead of 'url'
/tool fetch address=10.10.10.10 host=www.example.com src-path=status.txt method=http;
Where 10.10.10.10 is the proxy server's IP
Instead of:
/tool fetch url="http://www.example.com/status.txt";
Below is a group of scripts that worked for me. You can add these, then setup a scheduler to run "check_status" at whatever interval you desire.
#### script: check_status
# Edit the following values for your configuration:
#
# proxyIP = IP Address of your proxy server
# host = Domain name where your status page is hosted.
# path = Path for status page.
# vString = Some text to look for on status page to confirm proxy is online.
# timeout = Time in seconds to wait for fetch to download page before failing.
#
# As set, this would check that "some text to verify" is included on
# page downloaded from http://www.example.com/status.html
# via proxy server at 10.10.10.10:8080
#
:global proxyIP "10.10.10.10";
:global host "www.example.com";
:global path "status.html";
:global port 8080;
:global vString "some text to verify";
:local timeout 3;
:global fstatus;
:execute fetch_status;
:local count 0;
:while ( $fstatus != "success" && $count < ($timeout*10) ) do={
:set count ($count+1);
:delay 0.1;
}
:if ($fstatus = "success") do={
:execute check_proxy;
} else={
:execute disable_proxy;
}
/system script environment remove [/system script environment find name=fstatus];
#### script: fetch_status
:global fstatus;
:global proxyIP;
:global host;
:global path;
:global port;
/tool fetch address=$proxyIP port=$port host=$host src-path=$path dst-path="status.txt" mode=http;
:set fstatus "success";
#### script: check_proxy
:global vString;
:local result [/file get status.txt contents];
:if ($result~$vString) do={
:execute enable_proxy;
} else={
:execute disable_proxy;
}
/file remove [/file find name~"status.txt"];
#### script: enable_proxy
# Script to run if proxy is online.
#### script: disable_proxy
#script to run if proxy is offline.
This will first check if the MikroTik can access the status page you specified through the proxy. Next it will verify some string exists within the status page to ensure you're not just seeing some redirect from the proxy. On the status page, you might also want to include the NO-CACHE meta tag. My status page is simple:
<html>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
proxy-okay
</body>
</html>