expose icon indicating copy to clipboard operation
expose copied to clipboard

Correct URLs aren't being generated

Open ah040100 opened this issue 5 years ago • 7 comments

I booted up a PHP server by running php artisan serve and then I ran expose share http://localhost:8000.

Untitled

ah040100 avatar Jun 19 '20 06:06 ah040100

I was able to reproduce this too. It works fine when sharing the local URL on port 80/443.

I believe the problem comes from us not sending the X-Forwarded-Port header and therefore Symfony/Laravel does not trust the proxy server and does not use it to build the URL.

mpociot avatar Jun 19 '20 06:06 mpociot

Alright, after looking into this some more this seems to be related to the way that we set the Host and X-Original-Host header.

Before the incoming HTTP request gets sent to the connected client, expose modifies the Host header to match the host that was specified when the connection was set up.

See: https://github.com/beyondcode/expose/blob/e870878bceb84b9f5d8ec6c81bb89078e2489d15/app/Server/Http/Controllers/TunnelMessageController.php#L116

For example, when doing expose share my-site.test , the host would be my-site.test. For expose share localhost:8000 it would be localhost:8000.

And that exactly seems to be the problem. If we don't have a special hostname, we should use the expose server subdomain+domain combination here.

mpociot avatar Jun 19 '20 09:06 mpociot

I haven't used laravel zero before but i'd be willing to take this on if that's okay

jamesdube avatar Jun 22 '20 09:06 jamesdube

@jamesdube, if you need any help with Laravel Zero I'd be happy to help. 👍

owenvoke avatar Jun 25 '20 12:06 owenvoke

@owenvoke Thanks will ping you

jamesdube avatar Jul 01 '20 07:07 jamesdube

Also

expose http://localhost/ gives:

Expose-URL:		http://uzr1ysmxsw.sharedwithexpose.com:443
Expose-URL:		https://uzr1ysmxsw.sharedwithexpose.com

Note the http (no S) and :443 which is invalid - when used gives:

Screenshot 2021-07-27 at 10 23 00

PhilETaylor avatar Jul 27 '21 09:07 PhilETaylor

Hi, I can confirm that the issue from @ah040100 still same. I'm using expose version 2.6.2. Currently, the solution I can use is using Laravel Valet to create local custom domain and let expose detect when I run expose command. If you're using Windows, maybe you can use Laragon to create local custom domain.

kresnasatya avatar Sep 30 '23 08:09 kresnasatya