Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ember serve custom header support #17714

Closed
Redsandro opened this issue Mar 6, 2019 · 3 comments
Closed

Ember serve custom header support #17714

Redsandro opened this issue Mar 6, 2019 · 3 comments

Comments

@Redsandro
Copy link

Redsandro commented Mar 6, 2019

I would like to set a custom header to be served with every ember serve response. As far as I know, this is not possible.

ember serve <options...>
  Builds and serves your app, rebuilding on file changes.
  aliases: server, s
  --port (Number) (Default: 4200) To use a port different than 4200. Pass 0 to automatically pick an available port.
    aliases: -p <value>
  --host (String) Listens on all interfaces by default
    aliases: -H <value>
  --proxy (String)
    aliases: -pr <value>, -pxy <value>
  --proxy-in-timeout (Number) (Default: 120000) When using --proxy: timeout (in ms) for incoming requests
    aliases: -pit <value>
  --proxy-out-timeout (Number) (Default: 0) When using --proxy: timeout (in ms) for outgoing requests
    aliases: -pot <value>
  --secure-proxy (Boolean) (Default: true) Set to false to proxy self-signed SSL certificates
    aliases: -spr
  --transparent-proxy (Boolean) (Default: true) Set to false to omit x-forwarded-* headers when proxying
    aliases: --transp
  --watcher (String) (Default: events)
    aliases: -w <value>
  --live-reload (Boolean) (Default: true)
    aliases: -lr
  --live-reload-host (String) Defaults to host
    aliases: -lrh <value>
  --live-reload-base-url (String) Defaults to baseURL
    aliases: -lrbu <value>
  --live-reload-port (Number) Defaults to same port as ember app
    aliases: -lrp <value>
  --live-reload-prefix (String) (Default: _lr) Default to _lr
    aliases: --lrprefix <value>
  --environment (String) (Default: development) Possible values are "development", "production", and "test".
    aliases: -e <value>, -dev (--environment=development), -prod (--environment=production)
  --output-path (Path) (Default: dist/)
    aliases: -op <value>, -out <value>
  --ssl (Boolean) (Default: false) Set to true to configure Ember CLI to serve using SSL.
  --ssl-key (String) (Default: ssl/server.key) Specify the private key to use for SSL.
  --ssl-cert (String) (Default: ssl/server.crt) Specify the certificate to use for SSL.
  --path (Path) Reuse an existing build at given path.

Every now and then there's a good reason. For example, Chromium's mixed content experiment has Chrome and Chromium blocking http media requests on https sites.

In order to disable this non-standard behavior, you need to explain to all your customers that they need to opt-out from this experiment, or simply send a mixed-content: noupgrade header with the html content of your Ember site.

The same goes for FastBoot sites: ember-fastboot/fastboot-app-server#100

@stefanpenner
Copy link
Member

stefanpenner commented Mar 7, 2019

I wouldn't be apposed to accepting an addition that exposed this.

That being said, I suspect it can be accomplished, via someone inconvenient public API today, via in-repo add-on, that insert's itself into the express middleware chain.

Something like: https://github.com/ember-cli/ember-cli/blob/c97dee84155f05061868e34c44b250991127eba2/lib/tasks/server/middleware/broccoli-serve-files/index.js#L18

That also mimics the appropriate before/after clause to be "after: "broccoli-watcher": https://github.com/ember-cli/ember-cli/blob/master/lib/tasks/server/middleware/broccoli-serve-files/package.json#L6-L9

@Redsandro
Copy link
Author

Interesting links. I did not now about ember-addons. Not much documentation.

Apparently, there is such a thing as /dist/_headers? See https://github.com/shipshapecode/ember-cli-netlify

@locks
Copy link
Contributor

locks commented Apr 19, 2020

Closing as resolved. Please re-open otherwise!

@locks locks closed this as completed Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants