Understanding Okta redirect uri setup with Asp.Net MVC app in PCF with Autoscaler

We do have an Asp.net MVC application that is deployed in PCF. It also have the autoscaler enabled.

We are trying to add OKTA authentication in this app and getting 404 for the default redirect uri (http://pcfdomain/authorization-code/callback) that is supposed to be setup by OKTA.
After spending several hours on this issue, we found that the issue occurs only while Autoscaler is enabled for the application. When it is disabled, OKTA authorization happens and redirects back to our application successfully.

I would like to know more about how OKTA sets up the default redirect url. Would like to know if it takes any details from the PCF container like port number etc.
Also any reference about OKTA redirect url builder or pcf autoscaler would be helpful.

Thanks in advance!