Do not add `error_page` in nginx gitlab http config if there isn't a custom 422 page

Spin-off of the discussion started in https://gitlab.com/gitlab-org/gitlab-ce/issues/29145#note_28764140

GitLab tries to provide some informative information in the error pages (e.g 422 "Email already taken"), but due to the statement of error_page 422 /422.html in the nginx config this information is not shown.

Current implementation

In Ngnix.parse_error_pages custom_error_pages is checked if there are custom pages for the various http status is. If there are the custom page is used, if there isn't the default page is used. In nginx-gitlab-http.conf.erb the error_page statement for each status code is added.

Proposed solution

Only add statements like error_page 422 /422-custom.html if there was a custom error page installed. If there isn't a custom page, rely on the error pages generated by the GitLab rails app.

/cc @stanhu @ibaum

Assignee Loading
Time tracking Loading