Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The URL is invalid: two slashes are needed after the http(s):. #417

Open
ChickenDipper1 opened this issue Apr 7, 2022 · 7 comments
Open
Labels

Comments

@ChickenDipper1
Copy link

ChickenDipper1 commented Apr 7, 2022

Hello,

I have managed to get cors-anywhere setup on my plesk server :)
But I seem to be running into an issue I cannot figure out, no matter what URL I use I am presented with the error:
" The URL is invalid: two slashes are needed after the http(s):. "

This error shows no matter what URL I try to access for example:

https://mycorsproxy.url/http://google.com
https://mycorsproxy.url/https://google.com

Am I missing something obvious here?
Any help is much appreciated, thank you!

@FelipeGerolomo
Copy link

Same issue! I´m using Azure Cloud

@Rob--W
Copy link
Owner

Rob--W commented Apr 10, 2022

You have something else running in front of CORS Anywhere that normalizes the URLs. You should disable that URL rewriting mechanism, to preserve the original request URL. If that is not possible at all, an alternative is to omit the scheme.

From a quick search, it seems that Plesk uses Apache. See https://github.com/Rob--W/cors-anywhere/issues/308

For Azure Cloud, see #82.

@ChickenDipper1
Copy link
Author

Thank you for pointing me in the right direction, turning off nginx proxy mode under nginx settings solves the issue in Plesk.

@bulk88
Copy link
Contributor

bulk88 commented Mar 14, 2023

Cloudflare Workers W3C URL JS class has a well known bug that turns "//" into "/" . The CF bug can be googled.

@rishi-gurung
Copy link

please guide vercel also

@Its-Just-Nans
Copy link

If this is useful for someone

Here is a config for nginx

  1. start your cors-anywhere at localhost:4200
  2. Add this config to the nginx
  merge_slashes off;
  location / {
      proxy_pass          http://localhost:4200/;
  }

@prusswan
Copy link

prusswan commented Jun 5, 2024

On PaaS platforms (e.g. Heroku) where there is no "nginx" to configure, add a check before

var location = parseURL(req.url.slice(1));
(some may choose to fix the parseURL function instead)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants