I have registered two views:
config.add_route("home", "/home")
config.add_route("home/data", "home/data")
/home view has some Javascript code in the frontend that will fetch data from home/data
What is proper way to allow the access home/data if users access website via: mysite.com/home?
I tried to check request.referer but, it seems easy to modify/hack.
Let
H(m)be a function that hashes a message, perhaps SHA3.Create a secret
Swhich only your webserver knows.The
/homepage will have a link tohome/data. Change that link each time you display the page. The HREF should include a pair of query parameters:timeis current timestamp, e.g. seconds since 1970 epochnonceisH(S + time)The
home/datapage should report a permission error iftimeis not a fresh timestamp, ornoncedoesn't validate.So we have one page producing links to a data page, and those links are the only way to retrieve the data contents.