-
Notifications
You must be signed in to change notification settings - Fork 435
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
PC浏览器访问不显示数据 #17
Comments
我也遇到相同问题,但是手机访问也不正常 |
我已经提交合并请求 #18 来临时解决这个问题,需要的朋友可以将 const Api = 'https://api.uptimerobot.com/v2/getMonitors'; 改为 const Api = 'https://uptimerobot-api.renfei.net/v2/getMonitors'; 可以临时解决这个问题,想要根本解决的话,还需自己搭建反代服务。 |
请问可以po一份CF的workers的反代源码吗? |
好的,由于是我临时解决这个问题,没有想太多,以下代码没有调优,只是我手写实现了功能,可以作为参考: async function handleRequest(request) {
let apiUrl = request.url.replace("uptimerobot-api.renfei.net","api.uptimerobot.com")
request = new Request(apiUrl, request)
let response = await fetch(request)
response = new Response(response.body, response)
response.headers.set("Access-Control-Allow-Origin", "*")
response.headers.set("Access-Control-Allow-Methods", "*")
response.headers.set("Access-Control-Allow-Credentials", "true")
response.headers.set("Access-Control-Allow-Headers", "Content-Type,Access-Token")
response.headers.set("Access-Control-Expose-Headers", "*")
return response
}
addEventListener("fetch", event => {
const request = event.request
event.respondWith(handleRequest(request))
}) |
万分感谢!!! |
官网间歇性的 CORS 抽风,和 PC 浏览器无关,不是技术问题; |
嗯,理解并支持您的严谨态度。 我当时也想了下会不会产生安全问题,但我看过官方文档以后,只读的key 所以我就发出来了,作为目前没有很好的解决方案时的临时解决办法,让页面可以先展示出来,再慢慢研究解决办法。 |
不仅仅是数据隐私的问题,谁能保证第三方服务会一直 online 呢? |
最新的 v.1.5.1 版本新增了 ApiDomain 配置,可自定义接口域名; |
不论是自己搭建的还是演示站,在PC上换了3个浏览器,页面能正常显示,但显示数据的部分一直转圈,用手机访问正常,这是哪的问题?
The text was updated successfully, but these errors were encountered: