#204 all gzipped artifacts are served as text/plain
Opened 7 years ago by kparal. Modified 6 years ago

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:
https://taskotron-dev.fedoraproject.org/artifacts/all/55a5d4d6-dd7a-11e6-a20a-525400cb0b45/task_output/results/job_report.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
</DirectoryMatch>

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 this ticket to be solved first.


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.

Can we please disable gzipping everywhere until we have a better solution? Currently even the production reports are broken:
https://taskotron.fedoraproject.org/artifacts/all/dedb65bc-4793-11e7-a421-5254008e42f6/task_output/avocado-result/html/results.html
And people start using those.

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

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

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:
https://taskotron-dev.fedoraproject.org/artifacts/all/fd064e20-47a8-11e7-bdc7-525400cb0b45/task_output/avocado-result/html/images/sort_asc.png.gz
They are served with Content-Type: text/css.

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

Metadata Update from @kparal:
- Issue tagged with: infrastructure

6 years ago

Login to comment on this ticket.

Metadata