kevmoo / dhttpd

A simple HTTP server that can serve up any directory, built with Dart.
https://pub.dev/packages/dhttpd
BSD 3-Clause "New" or "Revised" License
107 stars 30 forks source link

Add support for custom response headers #61

Closed johnpryan closed 10 months ago

johnpryan commented 10 months ago

This is helpful when you want to return custom response headers. For example, if you want to enable SharedArrayBuffer support for a Flutter app with the skwasm renderer:

flutter build --wasm --web-renderer=skwasm
dhttpd --path=build/web_wasm --headers="Cross-Origin-Embedder-Policy=require-corp;Cross-Origin-Opener-Policy=same-origin"
kevmoo commented 10 months ago

@johnpryan – maybe support headers in a file? Is there a convention for that?

it'd be MUCH easier to repeat over time

johnpryan commented 10 months ago

I'm not sure there's a common way to define HTTP headers other than in code. How about a JSON file?

johnpryan commented 10 months ago

I think I prefer a flag, normally I use scripts when I want repeatability.

parlough commented 10 months ago

I was overriding the headers in Chrome :P, this is much easier 💙