We are cosrtrained in a very stupid situation because of some strange network policy of a customer
The customer WANT to use, from inside its network, our laravel webapp using simply a standard domain, so we set our .rnv like
APP_URL=http://normal.domain.ext
SANCTUM_STATEFUL_DOMAINS=normal.domain.ext
BUT from outside the network this domain is not available at normal port 80, but it's made available at port 20080, so we should use
APP_URL=http://normal.domain.ext:20080
SANCTUM_STATEFUL_DOMAINS=normal.domain.ext:20080
I have NO IDEA on how to detect and switch dinamically the used port
The main problem is that we are injecting from php to js the url to make api calls because there is a part of app made using Vue due to high-interactions needs of our customer. So Vue must call the api on the same backend codebase, se js needs to know the port where app is running and MUST be using the same port otherwise santcum auth will not work.
This is the problem.
The question remain this:
How to detect which server port is using the user to access the app and then change dinamically the configurations?