PierreZ / goStatic

A really small static web server for Docker
GNU General Public License v2.0
391 stars 77 forks source link

Multiple headers? #24

Open llech opened 4 years ago

llech commented 4 years ago

Is it possible to set multiple http headers?

I've added to my deployment:

args: ['-append-header', 'Content-Type:application/json', '-append-header', 'Cache-Control:max-age=120']

but only the 2nd header was added (Cache-Control).

PierreZ commented 4 years ago

Hello @llech !

You are right, the flag append-header is working on a single header. Do you want to contribute to goStatic? That would be a really nice feature :rocket:

kamil-kielczewski commented 4 years ago

@PierreZ I like your server - is very nice :) - However currently I need something likie this: set arbitrary headers per arbitrary file (maybe Including support for wildcard pattern)

In my case I need to set "Content-Type: application/wasm" for all files *.wasm

I never write anything in GO but I cant try to do it - my proposition is to add following parameter

-append-file-headers path/to/file/with/wildcard*.wasm Content-Type:application/wasm,nextHeader:nextValue,...

(so first we put file path, then headers separated by comma) (we should be able to add more than one -append-file-headers parameter)

@PierreZ what do you think about this?

PierreZ commented 4 years ago

Maybe we should automatically detect wasm file and add the right header directly, what do you think about this @kamil-kielczewski?