1

I have a dynamic webpage which I want to create a "frozen" copy of.

Typically I would do something like wget -m http://example.com, and then put the files in the document root of the web-server.

This site however has some dynamic content, including dynamically generated images, for instance

http://example.com/company/123/logo

This means that in order to mirror the page, I need to

  1. Save whatever headers the server currently serves for each URL (at least which MIME types it reports).

    This can be done using the wget option --save-headers.

  2. Serve the static pages and serve the proper headers (at least the content type headers) for each file.

    (This I have no idea of how to do.)

What is the best way to solve this? Any suggestions are welcome.

Put differently: How can I serve files without an extension with the correct MIME type header? (Where the original webserver defines what the correct MIME type really is.)

aioobe
  • 371
  • 1
  • 4
  • 16
  • 2
    I don't see why you need to serve the original headers along with the "dynamic content". – womble Jul 04 '12 at 15:14
  • Because a binary file such as `/company/123/logo` is not magically perceived as a jpeg by the browser without proper headers. – aioobe Jul 04 '12 at 21:51
  • So the question you really *should* ask is "how can I serve files without an extension with the correct MIME type header?". – womble Jul 05 '12 at 01:47
  • Yes. But there are som (extensioness) URLs pointing to zip files, some to files with html-content, javascript.content and so on. So instead of listing them all as you suggest, I would just like to preserv the headers. At least *some* headers. – aioobe Jul 05 '12 at 06:24
  • I assume you're not talking to me when you say "listing them all as you suggest", because I *certainly* didn't suggest having a list of filename to MIME type mappings -- that would be stupid. – womble Jul 05 '12 at 07:59
  • Woops. Was a bit quick on my reply. I thought you suggested to hard-code jpeg mime type for certain image files. Updated the question with your formulation. – aioobe Jul 05 '12 at 09:48

1 Answers1

0

If you can live without the last bit of your question ("where the original server defines what the correct MIME type really is"), and you're using Apache, you can use mod_mime_magic to automatically detect and serve the correct MIME type for your files.

womble
  • 96,255
  • 29
  • 175
  • 230