Setting your HTTP headers properly is important. Otherwise you can get an unwanted result as we'll see in this post with pages.gitlab.io.
Gitlab is the open-source variant of Github. The GitLab Community Edition has almost all functionality that Github offers, but in contrary to Github the GitLab CE is free and open-sourced. If you want you can run GitLab CE on your own server.
Similar to Github pages, GitLab launched pages.gitlab.io a couple of months ago, mentioned in their blog post in december 2015. GitLab Pages is only available for the Enterprise Edition, but as GitLab.com runs GitLab Enterprise Edition, this service is freely available to users on Gitlab.com (which is also free to use).
When I was looking at pages.gitlab.io I got an unexpected result. I was looking for some example pages built with GitLab Pages but because I found no link to some examples, I tried to browse to pages.gitlab.io/examples. Not so surprisingly I got a HTTP 404 error, but what was unexpected whas the formatting of that error page. It looked like so:
It was not interpreted as a HTML page by the browser, but instead presented as a plain text file.
The problem was with the HTTP headers. Quickly using the Chrome dev tools
I got the headers for
http://pages.gitlab.io/examples, but for the
sake of keeping my networking skills sharp I confirmed this by using telnet:
I opened a
telnet connection and issued a HTTP
HEAD command to get the headers of
http://pages.gitlab.io/examples. Not surprisingly the
Content-Type header was set to
charset=utf-8 instead of
text/html; charset=utf-8. This
caused the browser to display the HTTP response as plain text instead of a HTML
I searched the GitLab issue tracker checking whether this issue was already created. I didn't found anything so I created an issue. Two hours later they responded saying that it was fixed in this commit and will be fixed in the next 8.7RC.