# CakePHP in a non standard port

**URL:** <https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725>\
**Category:** Need Help\
**Tags:** help\
**Created:** [October 13, 2025, 6:48pm UTC](https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725 "2025-10-13T18:48:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcoturel](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dcoturel/32/1468_2.png) [@dcoturel](https://discourse.cakephp.org/u/dcoturel)\
**Post date:** [October 13, 2025, 6:48pm UTC](https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725/1 "2025-10-13T18:48:10Z")

</div>

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](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,

---

<div class="post-metadata">

**Author:** ![jmcd73](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/jmcd73/32/481_2.png) [@jmcd73](https://discourse.cakephp.org/u/jmcd73)\
**Post date:** [October 15, 2025, 6:44am UTC](https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725/2 "2025-10-15T06:44:55Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ADmad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/admad/32/20_2.png) [@ADmad](https://discourse.cakephp.org/u/ADmad)\
**Post date:** [October 15, 2025, 12:28pm UTC](https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725/3 "2025-10-15T12:28:07Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![dcoturel](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dcoturel/32/1468_2.png) [@dcoturel](https://discourse.cakephp.org/u/dcoturel)\
**Post date:** [October 15, 2025, 8:51pm UTC](https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725/4 "2025-10-15T20:51:22Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![ADmad](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/admad/32/20_2.png) [@ADmad](https://discourse.cakephp.org/u/ADmad)\
**Post date:** [October 16, 2025, 6:47am UTC](https://discourse.cakephp.org/t/cakephp-in-a-non-standard-port/12725/5 "2025-10-16T06:47:49Z")

</div>

> ..could I set this to the corresponding URL in the app\_local.php?

Yes
