简体   繁体   English

当我的链接中有参数时,使用 https://allorigins.win/ 传递 Cors 时出现问题

[英]Problem with using https://allorigins.win/ to Pass Cors when my link has parameters in it

I would like to use this website 's service raw?url= API but there is problem when my own link contains a few parameters.我想使用这个网站的服务raw?url= API 但是当我自己的链接包含一些参数时会出现问题。 example:例子:

api: https://api.allorigins.win/raw?url=
destination: https://nocors2.glitch.me/webm?a=b&c=d

Seems they will confuse the link's parameters as the API's parameters when requesting.似乎他们在请求时会将链接的参数混淆为API的参数。 I would like to know if you can think of any solution I can pass this problem?我想知道你是否能想到任何我可以通过这个问题的解决方案?

i need a service to let me pass Cors restriction without making my own server, so far this website was the best thats why i would like to solve this.我需要一项服务来让我通过 Cors 限制而无需制作自己的服务器,到目前为止,这个网站是最好的,这就是我想解决这个问题的原因。

Thanks谢谢

You need to encode your URL since it's a parameter.您需要对 URL 进行编码,因为它是一个参数。 See RFC 3986 for more details.有关详细信息,请参阅RFC 3986

For JavaScript , this would be:对于JavaScript ,这将是:

"https://api.allorigins.win/raw?url=" + encodeURIComponent("https://nocors2.glitch.me/webm?a=b&c=d");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM