title: Why would an iptables nat prerouting rule continue to redirect even after removal
body: <p>To give as basic of a rundown as possible, I have 2 servers running. One server is apache running on 80, the other is a recaptcha server daemon I've created in golang running over 29999. I have an application running that monitors all events coming across the host, and if any kind of &quot;shun worthy&quot; traffic hits the box. It will shun your ip via an <code>ipset add &lt;set&gt; &lt;ip&gt;</code>, and it will add a nat prerouting rules on 80 and 443 with the target IP to redirect them to port 29999. Using 1.1.1.1 for example</p>
  <p><code>-A RECAPTCHA-PREROUTE -s 1.1.1.1/32 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 29999</code></p>
  <p><code>-A RECAPTCHA-PREROUTE -s 1.1.1.1/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 29999</code></p>
  <p>Fast forward a bit: Im trying to hit port 80 (im shunned). I get redirected correctly to my daemon. I solve the recaptcha, the recaptcha properly dials out to the daemon, the daemon properly removes the prerouting firewall rules for the IP, and removes them from the ipset. After the &quot;unshun&quot; the Golang daemon does a <code>http.Redirect(w, req, &quot;/&quot;, 200)</code> with the intention of sending you to <a href="https://example.com/" rel="nofollow noreferrer">https://example.com/</a>  , BUT instead, it sends me right back to the recaptcha daemon running on 29999, even though I can open a separate browser(edge gag), and it will take me straight to the intended endpoint on the separate browser. With that in mind, if I would have run the initial request on edge, its behavior would reflect the other browsers. A colleague of mine and I are convinced that its some kind of weird caching issue in the browser that we are missing proper handling for, but we have since then exhausted most of the possible solutions that we could find on the internet, such as proper caching headers being served, and adding meta tags to the html document.</p>
  <p>ex):</p>
  <p><strong>Golang</strong></p>
  <p><code>w.Header().Set(&quot;Cache-Control&quot;, &quot;no-cache, no-store, must-revalidate&quot;)</code></p>
  <p><code>w.Header().Set(&quot;Pragma&quot;, &quot;no-cache&quot;)</code></p>
  <p><code>w.Header().Set(&quot;Expires&quot;, &quot;0&quot;) </code></p>
  <p><strong>HTML</strong></p>
  <p><code>&lt;meta http-equiv='cache-control' content='no-cache'&gt;</code></p>
  <p><code>&lt;meta http-equiv='expires' content='0'&gt;</code></p>
  <p><code>&lt;meta http-equiv='pragma' content='no-cache'&gt;</code></p>
  <p>One more interesting thing to note is, after you get redirected incorrectly to the recaptcha daemon page after the unshun/firewall removal. If you push ctrl+r on the browser UI about ~20-50 times. You will eventually stop getting the recaptcha page, and it will properly hit the intended server endpoint. Also if you clear your browsers cache, it will immediately take you to the correct page as well. (which is why we feel this is some obscure caching issue.</p>