expose icon indicating copy to clipboard operation
expose copied to clipboard

Shared Sites list question when using reverse proxy

Open thomas-alrek opened this issue 5 years ago • 6 comments

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.

thomas-alrek avatar Jun 18 '20 12:06 thomas-alrek

Yeah, I know. This happens on my current server as well. This is worth a PR :)

mpociot avatar Jun 18 '20 13:06 mpociot

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

thomas-alrek avatar Jun 19 '20 08:06 thomas-alrek

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

mpociot avatar Jun 19 '20 09:06 mpociot

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?

thomas-alrek avatar Jun 19 '20 10:06 thomas-alrek

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.

peterfox avatar Jul 01 '20 14:07 peterfox

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

dbpolito avatar Feb 24 '21 18:02 dbpolito

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

Thomas-ICEPAY avatar Apr 25 '23 11:04 Thomas-ICEPAY

Closing this issue because it's old 🙈

sschlein avatar Dec 21 '23 13:12 sschlein