4

I have started to use Lighttpd and I have this .htaccess file which alters the response headers.

<IfModule mod_headers.c>
    Header unset Content-Type
    Header unset Content-Disposition
    Header set Content-Disposition attachment
    Header set Content-Type application/octet-stream
    Header add Content-Type application/force-download
    Header add Content-Type application/download
    Header unset Content-Transfer-Encoding
    Header set Content-Transfer-Encoding binary
</IfModule>

How can I translate this to work in Lighttpd?

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Loza Lowa
  • 41
  • 2

1 Answers1

3

You will need to use the following:

setenv.add-response-header = ( "Content-Disposition" => "attachment" )
setenv.add-response-header = ( "Content-Type" => "application/octet-stream" )
setenv.add-response-header = ( "Content-Transfer-Encoding" => "binary" )

I imagine you are trying to force file downloads as opposed to displaying the file in the browser? If this is the case you only need the application/octet-stream MIME-Type as per RFC 2046 ( https://www.rfc-editor.org/rfc/rfc2046 )

'The recommended action for an implementation that receives an "application/octet-stream" entity is to simply offer to put the data in a file, with any Content-Transfer-Encoding undone, or perhaps to use it as input to a user-specified process.'

Community
  • 1
  • 1
Kinetic
  • 1,714
  • 1
  • 13
  • 38