2

I have a situation where I want to use "Content-Length" header from another domain with Lighttpd using XHR HEAD request but I get Refused to get unsafe header 'content-length' message.

My idea is to add response header based on another response header in lighttpd.conf:

setenv.add-response-header = ('X-Content-Length' => GET_MY_RESPONSE_HEADER('Content-Length'))

Is there a way to write GET_MY_RESPONSE_HEADER() function/property in config file?

avall
  • 2,025
  • 2
  • 16
  • 28
  • You could do so in Lua using [mod_magnet](http://redmine.lighttpd.net/projects/1/wiki/Docs_ModMagnet). –  Feb 25 '15 at 09:38
  • I tried `mod_magnet` and failed. Lighty doesn't have access to COntent-Length header. – avall Feb 25 '15 at 17:13
  • Really ? I would expect it to be in `lighty.header[]`... –  Feb 26 '15 at 05:30
  • You see, setting Content-length wrongly may result in the connection pipeline breaking, a timeout or even garbled text taken as a request. It is something that only the content-generating module or script can reasonably set. I suggest that you redirect this HEAD request to a custom php script and have it handled there. You may not have any other option anyway. – Zdenek Jul 21 '16 at 18:32

0 Answers0