expose
expose copied to clipboard
Shared Sites list question when using reverse proxy
Hello. Thanks for this great piece of software.
I was wondering if it was possible to hide the port number in the Shared Sites tab. I am running the server on port 8080, but behind a reverse proxy at 80/443. This causes the list to display {subdomain}.{domain}:8080, which in my case is wrong.
Yeah, I know. This happens on my current server as well. This is worth a PR :)
@mpociot I can make a PR if you want. I was thinking this could be solved in one of the following ways. In Nginx, i could set the header X-Forwared-Port, and expose could parse that if available. The other option would be to use a setting in the config file.
Hm... can't we modify this dynamically based on the port that is used to visit the admin interface? If I'm on port 80 or 443, we could just omit port 8080
That might work. I'm just not sure how that works. Technically the server is still running on 8080 internally. Does PHP set its $_SERVER variables based on the proxied request?
You should be able to fix this by looking at x-forwarded-port check if it doesn't match the internal server, for instance an SSL proxy will give 443 while the server itself is on 8080.
I think i found where the problem is:
https://github.com/beyondcode/expose/blob/master/app/Server/Http/Controllers/TunnelMessageController.php#L108-L114
What's is happening is that we're setting the trusted proxy to the socket remote ip, which is different from what's is being checked on isSecure() method, which is server->get('REMOTE_ADDR').
I will try to play with that when i have a chance....
This information is available in the $connectionInfo object when the first connection is made. Isn't it better to store this in the connection storage and echo it back later instead of deriving it from the admin dashboard session?
https://github.com/beyondcode/expose/pull/378
Closing this issue because it's old 🙈