Comments (9)
我也遇到相同问题,但是手机访问也不正常
from uptime-status.
我已经提交合并请求 #18 来临时解决这个问题,需要的朋友可以将 src/utils/uptimerobot.js
中
const Api = 'https://api.uptimerobot.com/v2/getMonitors';
改为
const Api = 'https://uptimerobot-api.renfei.net/v2/getMonitors';
可以临时解决这个问题,想要根本解决的话,还需自己搭建反代服务。
from uptime-status.
我已经提交合并请求 #18 来临时解决这个问题,需要的朋友可以将
src/utils/uptimerobot.js
中const Api = 'https://api.uptimerobot.com/v2/getMonitors';改为
const Api = 'https://uptimerobot-api.renfei.net/v2/getMonitors';可以临时解决这个问题,想要根本解决的话,还需自己搭建反代服务。
请问可以po一份CF的workers的反代源码吗?
from uptime-status.
我已经提交合并请求 #18 来临时解决这个问题,需要的朋友可以将
src/utils/uptimerobot.js
中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))
})
from uptime-status.
我已经提交合并请求 #18 来临时解决这个问题,需要的朋友可以将
src/utils/uptimerobot.js
中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)) })
万分感谢!!!
from uptime-status.
官网间歇性的 CORS 抽风,和 PC 浏览器无关,不是技术问题;
另外作为一个基于官网 API 的产品,我不会在代码中 hardcode 第三方接口,这对用户是不负责任的;
针对这个抽风问题,后续会增加自定义 API 域名配置,使不使用第三方接口应该交给用户选择;
from uptime-status.
官网间歇性的 CORS 抽风,和 PC 浏览器无关,不是技术问题;
另外作为一个基于官网 API 的产品,我不会在代码中 hardcode 第三方接口,这对用户是不负责任的;
针对这个抽风问题,后续会增加自定义 API 域名配置,使不使用第三方接口应该交给用户选择;
嗯,理解并支持您的严谨态度。
我当时也想了下会不会产生安全问题,但我看过官方文档以后,只读的keyread-only api_key
,并不能有任何操作权限,而且本来就是在页面中公开的,也可以通过网络请求里看到明文的key,而且数据都是一些监控数据,我认为没那么敏感,毕竟使用这个状态页的场景,就是公开让别人看的吧。
所以我就发出来了,作为目前没有很好的解决方案时的临时解决办法,让页面可以先展示出来,再慢慢研究解决办法。
from uptime-status.
我当时也想了下会不会产生安全问题,但我看过官方文档以后,只读的key
read-only api_key
,并不能有任何操作权限,而且本来就是在页面中公开的,也可以通过网络请求里看到明文的key,而且数据都是一些监控数据,我认为没那么敏感,毕竟使用这个状态页的场景,就是公开让别人看的吧。所以我就发出来了,作为目前没有很好的解决方案时的临时解决办法,让页面可以先展示出来,再慢慢研究解决办法。
不仅仅是数据隐私的问题,谁能保证第三方服务会一直 online 呢?
cf workers 免费版也是有请求次数限制的对不
from uptime-status.
最新的 v.1.5.1 版本新增了 ApiDomain 配置,可自定义接口域名;
另外 README 中也增加了如何 Cloudflare Workers 搭建代码,欢迎更新;
from uptime-status.
Related Issues (20)
- 跨域报错 HOT 3
- 教程能否写清楚一点 HOT 1
- 更新到最新版,也更新了API KEY,但是打开界面一直在转圈 HOT 1
- 显示空白页面
- ㅤ HOT 1
- 跨域失效了 HOT 1
- 我配置了页面却是白色的 HOT 3
- cloudfare反代错误
- 有办法隐藏部分网址吗? HOT 2
- 如何重新打包檔案?
- 更新变慢了 HOT 3
- 速度问题
- CORS 连接404了
- [BUG]: getMonitor 返回 204 状态码 HOT 1
- 希望能够提供Webhook功能 HOT 1
- 请问怎么改网站的样式? HOT 1
- 获取 不到具体状态了
- Reverse days status
- 什么时候支持时间轴从左到右
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uptime-status.