Mattermost, Inc.

[SOLVED] Incorrect Redirect URI on Gitlab 8.9.3 + bundled Mattermost + Apache

Using Apache 2.4.7 on Ubuntu 14.04.4. Gitlab SSL configuration derived from; copied and modified for Mattermost as well.

When a user navigates to, a sign-in screen is presented. The button to “Login via Gitlab” is shown. Clicking this button initiates a request to, which returns a 302 Redirect to: Notice that the redirect_uri is missing the ‘s’ for HTTPS. This causes the loaded Gitlab page to return “The redirect URI included is not valid.”

Relevant gitlab.rb lines:

mattermost_external_url '' mattermost['enable'] = true mattermost['service_use_ssl'] = true mattermost['service_address'] = "" mattermost['service_port'] = "8065" mattermost_nginx['enable'] = false mattermost_nginx['redirect_http_to_https'] = true # this likely does nothing

How can I fix the redirect_uri that is presented by the main Mattermost login page?

Solved. Apache conf file for site had the following two lines in the VirtualHost section:

RequestHeader set X_FORWARDED_PROTO 'https' RequestHeader set X-Forwarded-Ssl on

Adding this third line did the trick:

RequestHeader set X-Forwarded-Proto "https"

Note how the original file ( does NOT include the correct header.