"The redirect URI is not valid" error with self-managed GitLab and OAuth Server on EC2

Problem to solve

Hello, I’ve been spending a lot of days trying to figure this one out but still haven’t gotten there. I want to use a self-managed GitLab instance for authentication before accessing the CMS of my website. The GitLab is running on a physical server, while the OAuth server is running in an EC2 instance in AWS. The exact code I’m running on the EC2 is this: GitHub - vencax/netlify-cms-github-oauth-provider: netlify oauth github client sending token in form as netlify service itself

The website itself is built using the Gatsby framework, hosted on AWS S3 and deployed by AWS CloudFront. The CMS is Decap CMS and is configured according to another guide online. Even after configuring everything aligned with the examples in the OAuth provider’s GitHub page and the TylerGaw page, I always end up with the error “The redirect URI is not valid” after entering my credentials to try and complete the OAuth flow.

What I want to know exactly is, how does GitLab interpret the redirect URI to be invalid? What is it checking/verifying? It’s highly difficult to troubleshoot without further detail on what makes the URI invalid in the first place. It doesn’t seem to communicate with the OAuth provider at all so I’m thinking there’s something else I need to do that is GitLab-specific.

Steps to reproduce

  1. Access the CMS panel of the website and press the log-in button to open a new window and be directed to GitLab
  2. Enter credentials
  3. Arrive at user page showing the invalid redirect URI error

gitlab-forum-post-1
gitlab-forum-post-2
gitlab-forum-post-3

Versions

Versions

  • GitLab 16.8