aleph-im / aleph-vm

Aleph.im VM execution engine
MIT License
41 stars 17 forks source link

Expose full client URL to VMs #176

Open hoh opened 2 years ago

hoh commented 2 years ago

Is your feature request related to a problem? Please describe.

From Telegram group Aleph.im Developers (Public):

What I need is the full url for the VM. so when accessing the VM with this link https://aleph.sh/vm/dbeb246f22cd797af26fa8c0626478d799f0ff81ae354f80c73e043e335d559e I only get the url "http://aleph.sh/" which is not the full url I need. However, THIS link : https://3pvsi3zczv4xv4tpvdagezdy26m7b74bvy2u7aghhycd4m25kwpa.aleph.sh/ will give me the full url (except that the protocol seen inside the VM is http instead of https ; minor inconvenience i suppose). I'm guessing what's happening is the host field of the http header is carried over to the request that's sent to the VM, but the path is overwritten. Since the second link I sent accesses the VM by using a subdomain instead of a path, you can get the full VM hostname from within the VM. That also explains the protocol header being overwritten from https to http.

hoh commented 2 years ago

The first part for solving this would be to add an endpoint to the example_fastapi that returns the HTTP headers received by the app.