6

Is it possible to save a static html file with built in http headers ? So that putting it on any server will work including the http headers?

If so how?

Niro
  • 1,371
  • 3
  • 17
  • 35
  • Why on Earth would you want to do that? – Chris S Oct 10 '11 at 12:39
  • need to call a page from an iframe on another domain and get user cookie which is on the site domain of my customers. So I want to drop a file in their domain which will read the cookie and redirect. The problem is IE doesnt allow cookies in iframe without p3p privacy policy. I want to add the policy to this file and still be able to drop it on any server and have this work. – Niro Oct 10 '11 at 13:54
  • 2
    @Niro: *Any* server? Sorry, no can do. The server landscape is, let's say, somewhat diverse: Apache, IIS, nginx, what-have-you. There is no Silver Bullet (TM) which would automagically Make It Work (TM) on any server; this isn't a Hollywood movie. – Piskvor left the building Oct 10 '11 at 14:32

4 Answers4

11

For Apache, there is the module mod_asis, which does just that - reads the file and sends it on its merry way as a complete HTTP response.

This module is shipped with Apache by default, but you need to enable it first (see the docs, there's a reasonable example).

1

I won't go so far as to say it is impossible but I would assume then that whatever reads that file prior to serving it would need to parse that file prior to delivery. This would then make this static html page more like an active server page, cold fusion markup, or java server page and no longer static html.

mahnsc
  • 1,776
  • 13
  • 11
1

I don't know of any webserver that will allow you to do this natively. There may be extensions available for some of the more popular software packages, but I don't know of any. What you are asking for is highly irregular.

That said, almost all web server software supports CGI, in which the script being called is expected to supply the relevant headers for the request. Therefor writing a short script that simply ready your "static file" in and returns it to the client should work. Depending on your application this could be anywhere from trivial to extremely complicated.

Chris S
  • 77,337
  • 11
  • 120
  • 212
0

Looks like its possible to add an http-equiv header. Not sure it works.

<meta http-equiv="P3P"  content='CP="HONK"'>
Niro
  • 1,371
  • 3
  • 17
  • 35