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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
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).
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.
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.