Method of Realizing Anti theft Chain by jsp
- 2021-08-17 00:41:07
- OfStack
This paper describes the method of realizing anti-theft chain by jsp. Share it for your reference, as follows:
Recently, I encountered the problem of chain theft, that is, copying one url address and accessing it in another place.
index. jsp page
<html>
<head><title>Simple jsp page</title></head>
<body>Place your content here
here is index jsp
get header info
<a href="a.jsp">a.jsp</a>
</body>
</html>
a. jsp page
<html>
<head><title>Simple jsp page</title></head>
<body>Place your content here
here is a. jsp
get header info
<%=request.getHeader("Referer")%>
<%if(null == request.getHeader("Referer") || request.getHeader("Referer").indexOf("yourdomain.com") < 0){%>
Be honest in life
<%}else{%>
Legal access
<%}%>
</body>
</html>
That is to say, it can be accessed from inside, and it is forbidden to paste the address directly in another browser
I hope this article is helpful to everyone's JSP programming.