-3

In Apache, is there any way (using scripts like CGI and PHP, etc.) that will fetch all static content (html, images, and files within a specified size range) and send it to the user as a randomized link, set with a (30 minute for example) expiration? This would preferably not use mod_proxy or it's reverse, as all files will be on the same server. I'm just trying to learn, for a reasonable way to make something like this: http://www.example.com/09-21-2011/USA/CA/article-name.html to appear as http://www.example.com/09-21-2011/USA/CA/randomnumbersandletters (with no .html). I realize the html part can be fixed easily with mod_rewrite.

Any help on this would be much appreciated.

There is an example of this working here: http://memory.loc.gov/frd/cs/httoc.html Click on any of the links to a section of the article, scroll to the bottom of that page.

Says this:

Do NOT bookmark these search results.

Search results are stored in a TEMPORARY file for display purposes. 
The temporary file will be purged from our system in a few hours.

Links as this:

.../cgi-bin/query/r?randomnumbersandletters

Optional function would be to store the temporary sessions in a SQL database and include user IP and time/date accessed.

U4iK_HaZe
  • 631
  • 5
  • 13

1 Answers1

2

This isn't a system administration problem, it's a programming problem.


A quick, ghetto solution algorithm:

  1. Establish a session
  2. When accessing a page encode some representation of that session along with some representation of the page requested in the URL bar
  3. If the session for accessing a document is expired or accessed from an invalid host deny the request

An equally ghetto solution for something like memory.loc.gov (which is actually pulling that data from a separate server and storing it in a temporary location)

  1. Establish a session
  2. When a file is requested see if we already have it locally in that session's directory.
    • If we have the file, display it (redirect the user or read it in using the scripting language)
    • If we don't have the file retrieve it and stick it in the session's temporary directory, then display as above.
  3. When a session's temp directory has not been accessed for TIME_PERIOD, delete it.
voretaq7
  • 79,345
  • 17
  • 128
  • 213
  • Selected as best answer, but note: This provides no information on how to actually govern the task, much like a table of contents of a book. So, a bit vague, but gives me something to work on in the wee hours of dawn. – U4iK_HaZe Sep 21 '11 at 22:44
  • @U4iK_HaZe: If the answer doesn't answer your question then there is no requirement to accept it. – user9517 Sep 22 '11 at 06:49
  • But it was the "best answer available" so I did. A few bonus points to voretaq7 won't even show up. – U4iK_HaZe Sep 22 '11 at 10:18