Skip to content

PoC to fix wrong port assignment of links

Mehmet Emin INAC requested to merge fix_wrong_port_assignment into master

What does this MR do?

The links generated by entities can have a wrong port assignment if the Rails application is running behind a reverse proxy. The reason is since the application is running behind a reverse proxy, generating URLs without the request context sets the default port to the URLs generated which is incorrect.

In my case, I am running a local Nginx process which listens on port 80 and 443 and I have the entry in my /etc/hosts file to resolve the gitlab.localhost to the IP address in my LAN but the URLs generated by Rails application is always pointing to gitlab.localhost:3000 as it does not generate the URLs within the context of the request. I think we should inject the controller context to entities to fix this behavior.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Merge request reports