Updating GitLab Pages certificate with API gives 400 Bad Request


I have an automated pipeline job that renews a certificate for one of my gitlab pages domain. The code obtains certificates from Let’s Encrypt and then update the GitLab Pages cert with:

curl \
  --verbose \
  --fail \
  --show-error \
  --request PUT \
  --form "certificate=@$CERT_FILE" \
  --form "key=@$KEY_FILE" \

This command worked for months but is now failing with 400 Bad Request. No more detail. A GET on the domain config works.

Any hint?


I noticed GitLab can now handle the Let’s Encrypt cert automatically so I’m going to try this on another domain as a test but still I’d like to understand why the API is failing