CakePHP in a non standard port

Hi!

I have a CakePHP 4 app developed and running in several onpremises customers. In one of those, they provided me a public location consisting of an URL and a non standard port:

https://application.domain.com:8091

The problem is that, in every POST, the application tries to redirect to the URL without the port, generating an error.

Is there any way to determine the non-standard port for HTTPS and HTTP?

Saludos,

Is there a Reverse Proxy running on port 8091 and passing back requests to the on-prem application? If so what type of reverse proxy is it e.g. Apache, nginx, haproxy? Each requires specific configuration to successfully serve an application.

Or is it a port forward? e.g. port 8091 externally to port 443 on-prem?

What web server software is serving the Cakephp application? What port / ports is it serving on?

The problem is that, in every POST, the application tries to redirect to the URL without the port, generating an error.

Why are you using “full” URLs for internal URLs in your app? By default the URLs would be like /foo/bar and the browser will automatically send them to the same domain and port.

Anyway, you can set the App.fullBaseUrl config in your config/app.php to https://application.domain.com:8091 so that full URLs are generated the way you want.

1 Like

Excellent. Thanks for your answers jmcd73 and ADmad.

In response to jmcd73, it is installed in apache2 with standard port. The port redirection is done elsewhere, with mechanisms I don’t know about.

In response to ADmad, the redirect is being done with the standardt Controller::redirect() method, and that redirection is the one not taking the port in consideration.

I have the baseUrl parameter you mentioned in false, so according to your answer, could I set this to the corresponding URL in the app_local.php?

Saludos,

..could I set this to the corresponding URL in the app_local.php?

Yes