all gzipped artifacts are served as text/plain
Open, HighPublic


We compress all our artifacts to save space, which is great. However it seems it breaks mimetypes and everything is served as text/plain. For example, this html:
is served as plain text.

Our current apache rule seems to be this:

<DirectoryMatch "^{{ public_artifacts_dir }}/all/(.+)/task_output/">
    RewriteEngine on

    RewriteCond   "{{ public_artifacts_dir }}/all/$1/task_output/$2.gz"  -f
    RewriteCond   "{{ public_artifacts_dir }}/all/$1/task_output/$2"     !-f
    RewriteRule   "^{{ public_artifacts_dir }}/all/(.+)/task_output/(.*)$"  "{{ public_artifacts_dir }}/all/$1/task_output/$2.gz"

    # mod_deflate doesnt work as expected for some reason
    # use custom filter instead
    SetOutputFilter gz-to-plain

    # keep the mod_deflate for reference though
    #AddEncoding x-gzip .gz
    #SetOutputFilter INFLATE
    #ForceType text/plain

I guess SetOutputFilter gz-to-plain is to blame, but I'm not familiar with it.

One solution is to fix this properly (so that mimetypes are respected). A fallback option is to compress only our logs and not task artifacts, but that would need T880 to be solved first.

kparal created this task.Jan 18 2017, 1:26 PM
mkrizek raised the priority of this task from "Normal" to "High".Apr 20 2017, 11:24 AM
mkrizek claimed this task.

We need to fix this sooner than later since this will impact dist git tasks that will have reports in html.

It also affects task-modularity-testing-framework, which reports in html.

So I fixed it for html. It's not pretty but it should do for this particular use case, for now. Leaving open until I come up with a proper solution.

Gzipping disabled on dev for the modularity demo next week.

kparal added a comment.Jun 2 2017, 2:00 PM

Can we please disable gzipping everywhere until we have a better solution? Currently even the production reports are broken:
And people start using those.

tflink added a comment.Jun 2 2017, 3:12 PM

Is it mostly css that's the issue? I have an idea for a fix, will see what happens on dev and if it works, will propose as FBR for prod

tflink closed this task as "Resolved".Jun 6 2017, 1:31 PM

This has been applied in production and seems to be working. Please re-open if the issue shows up again

kparal reopened this task as "Open".Jun 6 2017, 2:23 PM

I think we need to solve this for all file types (not just whitelist specific ones), or disable the compression (and use a compressed filesystem or something, if needed). Images still seem broken:
They are served with Content-Type: text/css.

tflink added a comment.Jun 6 2017, 2:24 PM

Yeah, for some reason, I got it in my head that this was just a CSS problem. Thanks for the correction.

mkrizek removed mkrizek as the assignee of this task.Jun 13 2017, 8:11 AM