Search code examples
javascriptgitlabgitlab-api

Gitlab: can I configure a served javascript file to be served as the client can execute it?


Version control repositories started to serve raw files as text/plain and to add the header content-type-options: nosniff so they can't be used as static hosting. I have an internal GitLab installation that I want to use to host some javascript (it would be used to access GitLab own API).

Is it possible to serve a raw file as Javascript? I'd like to turnoff the http header or change the mime-type of the serverd file.


Solution

  • No, it isn't possible to serve directly from the repository, since GitLab won't serve the correct mime type. If you want to do it, you probably need to use GitLab Pages.