httptoolkit / httptoolkit-ui

The UI of HTTP Toolkit
https://httptoolkit.com
GNU Affero General Public License v3.0
279 stars 102 forks source link

Deploy on server #120

Open mrafieefard opened 1 month ago

mrafieefard commented 1 month ago

How can I deploy ui on server and connect to it with server IP I tried to use nginx to proxy UI server but when I did that it can't connect to backend ( request to 127.0.0.1 ) image

Can I change the backend address to something I want?

pimterry commented 1 month ago

Hi @mrafieefard, you're welcome to try this if you want, but in general it's not supported and it probably won't work without significant changes.

There's quite a few places where the UI assumes the server is running on your local machine. You can run the UI anywhere, but the client loading the UI (your browser) is currently expected to be on the same machine as the server. Changing that will be more complicated than just changing one address: there's quite a few details to how the API communication works (CORS, which interfaces to listen on, etc) that will need changing to make this work at all, it breaks a few security assumptions too, and then there's plenty of subsequent features that won't work as expected due to embedded dependencies on this. For starters, all intercepted apps would start on the remote server instead of your local machine, which is almost never what you want.

Can you explain more about what you're trying to do and why?

mrafieefard commented 1 month ago

So first of all my government blocked so many useful services that I need they api so I can't do it with normal client on windows so what I'm trying to do is deploy httptoolkit on server and then connect my phone via http vpn

pimterry commented 1 month ago

Ah I see. That exact setup is very unlikely to work without quite a lot of development, sorry. You're happy to try, but it might take a lot of work.

I don't think you need that though. If you just connect your computer to a VPN, and then connect your phone to HTTP Toolkit on your computer (just using the official build with no changes) then all traffic from your phone will be sent via the computer's VPN. Does that make sense?

mrafieefard commented 1 month ago

Yeah i tried this but i don't know why its not working

mrafieefard commented 1 month ago

But I get vpn ip from safari

pimterry commented 1 month ago

Hmm, I'm not sure what could cause that - a VPN on your computer should directly modify the routing rules so that all traffic from your computer (including traffic sent through HTTP Toolkit) always goes via the VPN. This sounds like an issue with your VPN setup. How is your VPN configured?

As an alternative, you can configure a separate upstream proxy server in HTTP Toolkit directly, which might work for you - but that requires a Pro account for access to the advanced settings. More details here: https://httptoolkit.com/docs/reference/settings-page/

mrafieefard commented 1 month ago

I'm not using famous VPNs like nord ,express and etc maybe this is the client problem also I don't want to use VPN while using httptoolkit if some how I can deploy httptoolkit server and UI on my vps that would be great

pimterry commented 1 month ago

if some how I can deploy httptoolkit server and UI on my vps that would be great

Unfortunately right now, no, that's not supported. There is an issue tracking full support for this here: https://github.com/httptoolkit/httptoolkit/issues/288

In the meantime, a VPN should definitely work with the right client setup.

As an experimental option, you could try running HTTP Toolkit fully on a server (e.g. install a desktop environment, remote desktop into it, and then run the complete app there) and then manually configure your phone to use the proxy address for that machine (via Android settings). That will probably work, although it's not very convenient. It also implies exposing your proxy port to the internet globally, which might result in random traffic from elsewhere. Exposing this as a custom unusual port might help with that, or better you can use a firewall to limit incoming traffic to specific IPs. Again though, that's not officially supported - you're welcome to try it, but I'm afraid I can't help much and I can't guarantee it'll work.

mrafieefard commented 1 month ago

So do you have restrictions to do this? Because it maybe possible if I can use nginx service and also that vpn service I'm using can translate data to http proxy so I just need to proxy the web client and thats work, But I did that and got cors error and I don't know how to fix it If you can help me to fix it I really appreciate it

pimterry commented 4 weeks ago

Hi - no, I can't help you with this. It might work, you're welcome to try, but it really might not be possible in the way you're expecting, and there will be problems & limitations that are unfixable. In future this might be possible (by building solutions or a better UX around the various limitations and security concerns this creates) but not today. Opening the UI locally with a remote server is not supported and will probably break right now.

As above: I'd recommend either using a VPN or upstream proxy configuration on your computer, which should definitely work, or you could try using HTTP Toolkit fully remotely instead (with both the UI client & the server running on a remote machine).

mrafieefard commented 1 hour ago

Thanks