Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 Oct 10 '11 at 14:32

4 Answers 4

up vote 10 down vote accepted

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).

share|improve this answer
    
Nice! Forgot about this! –  mahnsc Oct 10 '11 at 12:59
    
Cant have it activated. I need to drop a file on their http root and thats it –  Niro Oct 10 '11 at 13:49
6  
@Niro: So, are you saying "the server should read my mind and do what I mean, can't be so hard"? The answer to that will be rather disappointing, I'm afraid. –  Piskvor Oct 10 '11 at 14:34

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.

share|improve this answer

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.

share|improve this answer

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

<meta http-equiv="P3P"  content='CP="HONK"'>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.