Context-level problems setting custom HTTP headers

Marcus

Well-Known Member
#1
Hi,

I'm having problems trying to make some settings work on a context level. Specifically, I'm trying to set the Expires headers and add some HTTP headers of my own.

I've set up a static context, and set the URI to the folder (relative to the doc root) of where the folders are. The files are set to accessible, I've selected Enable Expires, and put an entry of application/json=A10. The MIME type for JSON files is in the main server mime-types file. I've also added "x-Content: nothing" (without the quotation marks) in the 'Extra Headers' section.

Neither of these settings appear to make any difference. I know the context is recognized in part, because when I set the accessible to 'no', I get 403 errors. I also know that the Enable Expires settings works on a server and VH level, since I've checked them there and they appear in the responses. It's just on a context level. I've had a go trying to get .htaccess files working, but that didn't work either - but I don't want to use them anyway, so I'd rather try to get things sorted on a context level.

Any ideas?

Thanks in advance for any responses.
 

mistwang

LiteSpeed Staff
#2
Plase check your error.log, your context configuration may not go through at server startup time.

It works on our test server with a 3.0.1 installation.
 

Marcus

Well-Known Member
#3
Problem solved

The problem was my understanding of the documentation. I did not realize that the 'root' was the full path to the folder - I thought that if the URI was relative to the document root, then it could be left blank (as was suggested in the documentation), but in fact it appears that for a path relative to the $DOC_ROOT, you still need to do the path, but can use '.' (e.g. ./path/to/folder ). It's all working fine now, however I don't feel it was particularly clear in the documentation - something to look at perhaps.

One other slightly confusing thing with the documentation is the fact that different names are used for the same setting. In the online documentation, the term 'root' is used. In the configuration file, and the admin setup, the term 'location' is used. On the same page covering context online, the term 'location' is used for a different setting, relating to Java.

I appreciate that you've been busy getting version 3 up and running, and I commend you on an excellent product, but when you have time, it might be an idea to take a look at your online documentation and check that each section correctly corresponds to the latest version, and that they cover all the main mistakes that people might make.

Thanks again for your support.
 

mistwang

LiteSpeed Staff
#4
Yeah, the documentation need some improvements.
We are looking to hire a good technical writer for this kind of job. Hopeful, we will find one soon. :)
 
Top