titaniumnetwork-dev / Ultraviolet

A highly sophisticated proxy used for evading internet censorship or accessing websites in a controlled sandbox using the power of service-workers. Works by intercepting HTTP requests with a service worker script that follows the TompHTTP specifications.
https://docs.titaniumnetwork.org/proxies/ultraviolet
GNU Affero General Public License v3.0
440 stars 3.61k forks source link

TypeError while running on Google Cloud Shell #79

Closed tuta-amb closed 2 months ago

tuta-amb commented 8 months ago

I'm running this app on Google Cloud Shell Preview, and before you recommend another platform:

  1. Every single app host is blocked, only reason Google Cloud Shell isn't is because all Google domains have a hard coded whitelist.
  2. Shell Preview gives 50 hours a week of free usage
  3. My school trusts any google.com domain

However when deploying any Ultraviolet-based proxy, namely github.com/titaniumnetwork-dev/Ultraviolet-App and Holy Unblocker, I get the following error:

Error processing your request
Failed to load https://www.google.com/search?q=test
Internal Server Error
Code:   TypeError
TypeError: Failed to fetch

image Also, when deploying a simple TompHTTP bare server from NodeJs, I get the following 401 error:

RangeError: Failed to construct 'Response': The status provided (0) is outside the range [200, 599].

Issue #78 seems to have a identical problem. This is probably related to #77 and tomphttp/bare-server-node/issues/17. On the TompHTTP issue thread, it discusses setting the port visibility to public, and I may have read somewhere about Google Cloud Shell Preview requiring account authentication to access the preview, so that could be the problem, although I am not sure.

To reproduce:

  1. Launch Google Cloud Shell
  2. $ git clone https://github.com/titaniumnetwork-dev/Ultraviolet-App.git
  3. $ cd Ultraviolet-App
  4. $ npm install
  5. $ npm start
  6. Open web preview
  7. Go to any website
ProgrammerIn-wonderland commented 8 months ago

This is because of how previews work on Google cloud shell, you'd have to modify UV to make this work

ProgrammerIn-wonderland commented 8 months ago

Cut it out, both of you @Jokypond @ilikemen132

ghost commented 8 months ago

Cut it out, both of you @Jokypond @ilikemen132

so sorry

tuta-amb commented 8 months ago

@ProgrammerIn-wonderland Thanks, I suspected so, but I'm not familiar with Ultraviolet internals, so if you could guide me in the right direction, I would be happy to make this on my own and submit a PR.

ProgrammerIn-wonderland commented 8 months ago

I'm honestly not sure where to start, it would also require understanding how Google cloud auth works, but you can give it a shot

tuta-amb commented 8 months ago

Alright, @ProgrammerIn-wonderland I'll give it a try. I'm assuming that becuase Google Cloud Shell Preview requires authentication, the service worker that proxies requests doesn't get the requests sent.

xjzh123 commented 8 months ago

I have been installing Ultraviolet on Deta Space. The same problem encountered. I solved it by setting public: true, which I guess is basically the same as Gitpod's set the port visibility to public. So I guess this happens because Ultraviolet's request to the bare server is blocked by authentication? update:

the service worker that proxies requests doesn't get the requests sent.

This is reasonable too. But I don't know internal of how Ultraviolet talks to bare server, or how service workers work.

proudparrot2 commented 8 months ago

Yeah pretty sure it has to do with a firewall issue

tuta-amb commented 8 months ago

@xjzh123

So I guess this happens because Ultraviolet's request to the bare server is blocked by authentication?

Definitely. This official Google article confirms it: Cloud Shell - Preview web apps I think this could be achieved if I found the authentication headers that are necessary to make requests to the preview backend, and sent them along in the service worker proxy.

Also: How are you running on Deta Space? Just curious. Is there an app from the marketplace available or do I need to create my own app? (Which is possible, since my dev mode request did get accepted)

xjzh123 commented 7 months ago

@xjzh123

So I guess this happens because Ultraviolet's request to the bare server is blocked by authentication?

Definitely. This official Google article confirms it: Cloud Shell - Preview web apps I think this could be achieved if I found the authentication headers that are necessary to make requests to the preview backend, and sent them along in the service worker proxy.

Also: How are you running on Deta Space? Just curious. Is there an app from the marketplace available or do I need to create my own app? (Which is possible, since my dev mode request did get accepted)

I have created UltraViolet-App and Cobalt in the marketplace, so everyone can install them on deta.

rifting commented 2 months ago

Closed as stale