1

I have been writing automation scripts to generate and update SSL certificates using Namesilo, Letsencrypt and Gitlab APIs. I almost got to the end, but I am getting a 404 error when trying to update the SSL certificate on Gitlab.

The weird part is that the error happens on only one of my two projects. Specifically, running:

curl --header "Private-Token: XXXXXX" "https://gitlab.com/api/v4/projects/pallavagarwal07%2Fshort-links/pages/domains/pallav.xyz"

works fine and fetches the details of domain pallav.xyz in project short-links.

But, running:

curl --header "Private-Token: XXXXX" "https://gitlab.com/api/v4/projects/pallavagarwal07%2Fpallavagarwal07.gitlab.io/pages/domains/varstack.com"

returns a 404 error. However, what makes it weirder is that if I remove the domain name varstack.com from the URL, it gives me the list of domains as expected:

curl --header "Private-Token: XXXXX" "https://gitlab.com/api/v4/projects/pallavagarwal07%2Fpallavagarwal07.gitlab.io/pages/domains"

returns:

[{"domain":"varstack.com","url":"https://varstack.com","certificate":....]
  • Can you check the permissions of the user? It may be related – djuarezg Dec 06 '17 at 15:33
  • 1
    @djuarez The user is the owner pallavagarwal07 in both cases. I am using the same token in all cases. Token is generated using the first priviledge "Full Read/Write API access". – Pallav Agarwal Dec 06 '17 at 15:35

1 Answers1

1

I finally figured it out (although I would still classify this as a bug on the part of GitLab).

The ID needs to be url-encoded, which is why I had replaced / in the repository name by %2F. However the character . should not have been a problem (- in the former URL did not cause any problem). However, replacing . by %2E gives expected (correct) results.

I think this is a bug because:

  1. This behavior is not documented (which characters are allowed?).
  2. The URL without the domain name works flawlessly even without encoding ., including the API to add new domains (which also takes domain as a form parameter, and not in URL).

TL;DR

Using:

pallavagarwal07%2Fpallavagarwal07%2Egitlab%2Eio

instead of

pallavagarwal07%2Fpallavagarwal07.gitlab.io

in the URL makes it work.