dart-lang / webdev

A CLI for Dart web development.
https://pub.dev/packages/webdev
212 stars 71 forks source link

Add API for changing HTTP headers #530

Open johnpryan opened 4 years ago

johnpryan commented 4 years ago

It would be great if there was a way to customize or change the HTTP headers. For example, If you are developing an app within an iframe, you may want to change the X-Frame-Options header.

insinfo commented 1 year ago

I am also in need of this feature as I am building a large app with angularDart that uses sub apps in iframe

insinfo commented 1 year ago

@grouma @elliette @annagrin I downloaded the source code of webdev 2.7.2 but I didn't find where this header is being defined, I even commented line 2902 of the file http_impl.dart of dart-sdk but it seems that it had no effect

I tried this but it doesn't seem to work image

how to overwrite this https://api.flutter.dev/flutter/dart-io/HttpServer/defaultResponseHeaders.html

Any workaround?

leecommamichael commented 5 months ago

+1 I'd like to make my site cross origin isolated as I'm writing a WebGL2 game with Dart. This would give me access to higher precision timers in my debug app.

loryruta commented 2 weeks ago

It'd be great to have command line options to set custom headers, I'm developing an app, that depends on a Dart lib which loads a JS/Wasm module. The Wasm module makes use of SharedArrayBuffer which requires the following HTTP headers to be set, to be used:

Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp

Therefore I can't use webdev serve on app for developing lib (can't use the Wasm module).