GitLab Pages: serve page without .html extension

TL;DR: I need to know how to serve a page in GitLab pages without a .html (or anything else) extension at the end of the URL. Thanks!


Hi, I’m trying to renew my HTTPS certificate using Let’s Encrypt.

I’m at the step where I have to add a page with some text in it to prove that I own the website, as described in this section of GitLab’s own article describing how to do it.
The problem is that I can’t figure out how to make my website serve a page at a URL that looks like MYDOMAIN.com/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM.html

At first, my website was only an index.html file in the root directory, so I tried to just create a 5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM.html page in the /.well-known/acme-challenge/ subfolder, but I got a 404 error. So I switched over to Jekyll and used the permalink attribute to make the page available at the right URL. It worked when I jekyll serve'd my site locally, but when I push to GitLab, I still get a 404 error.

I really don’t know how to make this page available, and this domain site has to be available. It has to be available at this URL for Let’s Encrypt to issue the certificate, and my site has to be available over https in 12 hours maximum… Maybe this has to do with the fact that the URL is pointing to a “hidden folder” (it begins with a dot), I don’t know… Could anyone help me please?

Thanks a lot!

EDIT: It works when adding .html to the end of the URL, but as I said, I need the page to be served at the exact URL, without the .html at the end (unless someone knows how to make Let’s Encrypt use a URL slightly different than the one it expects). Does anyone knows how to do that?

EDIT 2: I got it to work with a slash (/) at the end, but I need to have nothing at the end…

Same problem here. Could you figure it out?

This is really about how the static site generator works and builds the site. For Jekyll, have you tried this https://about.gitlab.com/2016/04/11/tutorial-securing-your-gitlab-pages-with-tls-and-letsencrypt/?

Yes! Actually this tutorial was my starting point.

Following all the steps I found that building the site in Gitlab will not generate the link without the .html extension:

www.domaing.com/.well-known/.../long-link

Instead it will generate:

www.domaing.com/.well-known/.../long-link.html

And Letsencrypt won’t be able to validate your site.

I was messing around with permalinks and :output_ext and was able to make it work in my local machine, but not in Gitlab.
Finally I got my https working using another certificate from 1and1 but couldn’t solve this problem with the tutorial steps. Maybe not very important as Gitlab has announced letsencrypt support in a near future.

Thanks!

I have run into the same problem following the same tutorial https://about.gitlab.com/2016/04/11/tutorial-securing-your-gitlab-pages-with-tls-and-letsencrypt/ .
The point is that gitlabPages is not serving the HTML pages without extension, I’ve found several issues reported about it https://gitlab.com/gitlab-org/gitlab-ce/issues/41321.

During the domain validation process, the Letsenrypt agent do a GET request to a page without extension

http://YOURDOMAIN.org/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM

but gitlabPage is responding with 404 because the html file generated by jekyll is 5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM.html .

A workaround can be renaming the html file generated removing the .html extension. You can do it into the gitla-ci.yml after the bundle exec jekyll build ...

...
 - bundle exec jekyll build -d public
 - mv public/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM.html public/.well-known/acme-challenge/5TBu788fW0tQ5EOwZMdu1Gv3e9C33gxjV58hVtWTbDM
...

This is my gitlab-ci.yml https://gitlab.com/estrategies_per_apoderament_digital/estrategies_municipals_per_apoderament_digital/commit/02405290970eb5fe9b01312ce02f9934705bf5a2#587d266bb27a4dc3022bbed44dfa19849df3044c