简体   繁体   中英

Browser's Redirection

I'm writing an internet access tool for a LAN that uses Linux + iptables to redirect to a login page everytime a user tries to access to any web page. That login page asks for user and password and if the authentication was successful, it removes the iptables rule so the subsequent requests goes to the originally intended webpage.

This is the situation:

  1. If I go to http://www.abc.com , my default gw redirects me to 10.0.10.10/login.php
  2. I successfully login.
  3. If I try to go again to http://www.abc.com , the browser is automatically sending me back to 10.0.10.10, it's like some sort of caching.
  4. If I try to enter to another page other than abc.com, it works as expected.

How can I tell the browser to remove the "remembered" rule of redirection?

Based on the http://www.w3schools.com/tags/att_meta_http_equiv.asp

If you use these meta tags page wont be cached neither by a browser nor a proxy server:

<meta http-equiv=”expires” content="Wed, 22 Jul 1981 16:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="cache-control" content="no-cache" />

You need to Hard Refresh cache.

Usually you can do that with CTRL + F5 or CTRL + R

or you change your rule to make the second redirection to same page but with some # fragment identifier

eg: if user enters abc.com and gets redirected on login if he tries to go again to abc.com and you see that he was logged in redirect him to abc.com#1

You can remove that page/url from browser history using javascript that will do the thing you need. and also when user clicks back button on browser he will not get back to the previous page where he/she was log in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM