TritonDataCenter / sdc-adminui

Operator portal for Triton DataCenter
Mozilla Public License 2.0
15 stars 27 forks source link

Please add Content-Type header in all responses #254

Open bhechinger opened 4 years ago

bhechinger commented 4 years ago

I'm having a difficult time getting adminui to work behind Traefik. The best theory we have is that because Content-Type isn't being set by adminui Traefik is trying to guess what it is and sets it to application/x-gzip which results in just getting a downloaded .gz file instead of a rendered page.

bhechinger commented 4 years ago

@bahamat Just an FYI I had Traefik add Content-Type: text/html and it tried to render the page. Except that obviously broke JS and CSS content, but I feel like that's pretty good validation that our theory is correct.

bahamat commented 4 years ago

This can be worked around by configuring traefik not to add content-type headers based on sniffed payload (which it mis-identifies).

I'll leave this open for now, since it may be better for AdminUI to always explicitly set the content type, but for now the best option is for proxies to not add content type headers, and leave content type sniffing up to the browser.

bhechinger commented 4 years ago

The needed part for Traefik is this: https://docs.traefik.io/middlewares/contenttype/

I do also agree that it would be best if Content-Type were explicitly set by adminui but this does indeed work in the meantime.

Thanks for all your help @bahamat, you're the best!