GitLab.com HTML artifacts being served with text/plain Content-Type

On GitLab.com, my team has noticed that HTML files uploaded as artifacts in CI jobs are being served with a text/plain Content-Type header. They previously were served with text/html and displayed correctly in the browser, which was very useful for reviewing automatically-deployed work in MRs. This behavior changed sometime within the last couple days, as far as we can tell.

Version: GitLab Enterprise Edition 14.10.0-pre 2ecf1b368d1

Here’s an example request/response:

I wasn’t able to find any recent issues or discussions about this, but I did find an older issue about another time that this behavior regressed (though in that case, the Content-Type was application/octet-stream instead of text/plain): HTML artifacts are downloaded as files instead of served as webpages. (#332850) · Issues · GitLab.org / GitLab · GitLab

1 Like

Hello,

We also are on gitlab.com, with the Premium SaaS Plan. (retail-reload group). We have exactly the same issue, which is pretty disrupting as we use this feature in our Doc as code CI/CD pipeline, to review doc changes before deploying them in production.

We did not change anything in the CI/CD configuration. We noticed the error this afternoon (CST time), it was working properly 3 or 4 days ago: The files with the .html extensions were properly served with the text/html Content type on the project gitlab page, after the user clicked the link in the artifact browser:
https://gitlab.com/{group}/{subgroup}/{project}/-/jobs/{jobid}/artifacts/browse/{artifact_dir}/

The user would click on the link
https://gitlab.com/{group}/{subgroup}/{project}/-/jobs/{jobid}/artifacts/file/{artifact_dir}/index.html
then get redirected to :
https://{group}.gitlab.io/-/{subgroup}/{project}/-/jobs/{job_id}/artifacts/{artifact_dir}/index.html

  • Expected result: The HTML file is rendered as an HTML file by the browser
  • Actual result: The HTML content is rendered as a text file. The browser (we tried Safari and Chrome) does not seem to be at fault here, see OP: the gitlab pages sends the wrong content type for the file content

Could somebody from the Gitlab.com team have a look at this please ?

That you in advance,

Frederic

I think this might be the relevant issue?

That content-negotiation issue could possibly help if it was implemented, but it doesn’t look like it directly relates to the recent change in behavior.

When I searched yesterday, I didn’t see any relevant issues, but it looks like there is one now: Artifact html viewer not rendering anymore (#357078) · Issues · GitLab.org / GitLab · GitLab

Great! The Gitlab team is already on it. I hope the fix makes it to production quickly :wink:

1 Like