gpt4 book ai didi

flutter - CORS flutter 网

转载 作者:行者123 更新时间:2023-12-03 02:40:04 24 4
gpt4 key购买 nike

我遇到了一个大问题,使我的项目迟到了。我遇到了CROS问题,无法解决我的请求,我在.htacess中添加了以下几行,但无法正常工作,我无法理解

跨域请求被阻止:“相同源策略”不允许读取https://maps.googleapis.com/maps/api/place/autocomplete/json上的远程资源…nents = country:fr&key = MY_KEY。 (原因:CORS header “Access-Control-Allow-Origin”缺失)

RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.kosmos-digital.com/$1 [R,L]

Rewritecond %{HTTP_HOST} ^kosmos-digital.com$
Rewriterule ^(.*) https://www.kosmos-digital.com/$1 [QSA,L,R=301]

<ifModule mod_headers.c>
SetEnvIf Origin "http(s)?://(www.kosmos-digital.com|www.maps.googleapis.com)$" AccessControlAllowOrigin=$0
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
Header always set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
</ifModule>

我不认为这来自我的代码,但我将其放在下面:
try {
await Dio().get<String>("https://maps.googleapis.com/maps/api/place/autocomplete/json?input=28%20avenue%20pierre%20corneille&language=fr&components=country:fr&key=MY_KEY").then((e) {
print(e.data);
}).catchError(print);
// Map<String, dynamic> dataAsJson = await HttpUtils.getForJson(url, headers: headers);
// print(dataAsJson.toString());
} catch(e) {
print(e.toString());
}

最佳答案

根据您提供的详细信息,我无法进行最少的复制。您还有这个问题吗? GitHub上的这个thread似乎很相似,尽管我无法验证。如果您仍然对此问题不满意,请在此处将票证连同https://github.com/flutter/flutter/issues/一起提交给minimal repro和复制行为的步骤。

关于flutter - CORS flutter 网,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60457472/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com