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

cloudflare workers的调试浏览器能正常访问,chrome浏览器里访问返回Error 1101 #4

Closed
chawaa opened this issue Feb 22, 2021 · 9 comments

Comments

@chawaa
Copy link

chawaa commented Feb 22, 2021

您好:pixiv-cat的作者

我在部署pixivcat-cloudflare-workers时候遇到一个问题。

描述:cloudflare workers的调试浏览器里可以正常访问图片,但是在chrome浏览器里访问时,返回Error 1101

图1:在cloudflare workers的调试浏览器访问
图1

图2:在chrome浏览器里访问
图2

chrome 调试的console 选项,返回 get https://Domain-Name//75034219.jpg 500

参考:大体搭建步骤参考一分钟教程:利用cloudflare worker搭建在线代理--jsproxy 教程,把代码替换成本仓库的JS代码

先行感谢!

@jongcs
Copy link
Contributor

jongcs commented Feb 22, 2021

oauth.secure.pixiv.net 這個API接口近期接入了 Cloudflare,導致 Cloudflare Workers 使用的 IP 需要提交驗證碼才能正常獲取API資料。
調試時使用的IP則不會跳出驗證碼,所以可以正常獲取圖片。
要解決這個問題需要使用不會跳出驗證碼的IP做一個API接口的反向代理。

@chawaa
Copy link
Author

chawaa commented Feb 22, 2021

@jongcs 很高兴收到您的答复,现在有解决思路。需要确认一下,额外反向代理的API接口是oauth.secure.pixiv.net 吗? 除了cloudflare-workers外,我想把此代码部署到自己服务器上,能否给一些建议,

谢谢先送上....

@jongcs
Copy link
Contributor

jongcs commented Feb 22, 2021

經過測試,只有 oauth.secure.pixiv.net 需要額外代理,其他API端點沒有接入Cloudflare。

這個腳本是專為Cloudflare Workers設計,若要完全自行部屬,可以依照需求修改成 node.js 的 Express 應用程式。

@chawaa
Copy link
Author

chawaa commented Feb 22, 2021

@jongcs 好的,再次感谢。

@ancientcatz
Copy link

I have the same problem, how to solve it? by the way i'm a JavaScript beginner, I'm confused about the reverse proxy

@jongcs
Copy link
Contributor

jongcs commented Jan 8, 2022

You need to use a reverse proxy like nginx or caddy for oauth.secure.pixiv.net, bacause this endpoint is protected by Cloudflare.
It returns a captcha when accessing via Cloudflare worker's IP address.

@ancientcatz
Copy link

You need to use a reverse proxy like nginx or caddy for oauth.secure.pixiv.net, bacause this endpoint is protected by Cloudflare.
It returns a captcha when accessing via Cloudflare worker's IP address.

Can you give me the nginx configuration?

@jongcs
Copy link
Contributor

jongcs commented Jan 10, 2022

You need to use a reverse proxy like nginx or caddy for oauth.secure.pixiv.net, bacause this endpoint is protected by Cloudflare.
It returns a captcha when accessing via Cloudflare worker's IP address.

Can you give me the nginx configuration?

Simply put this in your server block.

location / {
    proxy_pass https://oauth.secure.pixiv.net/;
    proxy_set_header Host oauth.secure.pixiv.net;
}

@ancientcatz
Copy link

ancientcatz commented Jan 11, 2022

You need to use a reverse proxy like nginx or caddy for oauth.secure.pixiv.net, bacause this endpoint is protected by Cloudflare.
It returns a captcha when accessing via Cloudflare worker's IP address.

Can you give me the nginx configuration?

Simply put this in your server block.

location / {
    proxy_pass https://oauth.secure.pixiv.net/;
    proxy_set_header Host oauth.secure.pixiv.net;
}

In the end I didn't use NGINX because I didn't have a VPS so I used Vercel (free) as a reverse proxy and it works really well, thanks.

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

No branches or pull requests

3 participants