admin管理员组文章数量:1335180
I deployed this on Cloudflare Worker and I have assigned domain proxy.mydomain.tld
to the worker.
then I open on browser but I couldn't see the logo.png instead I see the error message says:
Too many redirects. /logo.png (repeating same url..) /logo.png
so I open original domain of worker (ends with workers.dev) and it is worked and show me the logo.png.
here is my worker code:
try {
// fetch to my website.
const imageResponse = await fetch("/logo.png", {
method: 'GET',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 (compatible; ImageProxy/1.0; +/proxy.html)'
}
});
// return image
return new Response(await imageResponse.blob(), {
status: 200,
headers: { 'Content-Type': imageResponse.headers.get('Content-Type') }
});;
} catch (err) {
return new Response(err, {
status: 500,
});
}
proxy.mydomian.tld
is proxied via Cloudflare, while others (e.g. *.mydomain.tld, mydomain.tld, www.mydomain.tld)
is DNS-only.
P.S: mydomain.tld and *.mydomain.tld
's A Record are points to my vps for frontend.
The Frontend VPS only installed certbot + nginx + zerotier vpn and configured to all HTTP(S) requests sent to www.mydomain.tld
will forwarded to my HomeServer's 80 port.
My HomeServer only installed nginx + zerotier vpn and hosting my website.
For HTTP=>HTTPS redirect and non-www to www redirect is done by Frontend Nginx.
And I thought this creepy setup cause this error.
本文标签: javascriptMy Cloudflare Worker that proxy image is not working properlyStack Overflow
版权声明:本文标题:javascript - My Cloudflare Worker that proxy image is not working properly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742382616a2464393.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论