Redirect from root to www not working

Hi, I have following rule. Page is accessible via https:/www.mydoman.com but no via https:/mydoman.com. I got: ERR_NAME_NOT_RESOLVED Here is my DNS config. I use pythonanywhere.com as hosting my Djnago app
No description
No description
12 Replies
DaniFoldi
DaniFoldi•4w ago
Hi 👋 You also need to add a DNS record for your apex and make sure it's proxied. If your only goal with mydomain.com is to redirect to www.mydomain.com, you can create an AAAA record and use 100:: as the value. By default it would be proxied, and as soon as DNS is propagated you should be good
K0034
K0034OP•4w ago
Hi @DaniFoldi . Thanks for you answer. Pythonanywhere.com not provide IP adress to set for apex domain 😦 They use CNAME. Is that AAAA record will be ok?
No description
DaniFoldi
DaniFoldi•4w ago
with 100::, Cloudflare will consider the record as originless, so if you don't redirect/etc/handle the request, your visitors will see a 522. With your rule in the first screenshot, https requests will all be redirected. You might want to also include http:// requests Otherwise if they gave you a CNAME for the root, Cloudflare will flatten it for you if you set a CNAME record on the apex (meaning it will serve A/AAAA records for any queries, not the CNAME)
K0034
K0034OP•4w ago
don't understand that 😛 Correct me if I wrong but all what I need is add rule to redirect also http and it will works if DNS propagate. Yes?
DaniFoldi
DaniFoldi•4w ago
yes
K0034
K0034OP•4w ago
It works! You are the best! Thanks a lot!
DaniFoldi
DaniFoldi•4w ago
glad it's working for you :MeowHeartCloudflare:
K0034
K0034OP•4w ago
Now i facing: Forbidden (403) CSRF verification failed. Request aborted. When try to log, but maybe is some Django issue
DaniFoldi
DaniFoldi•4w ago
hmm, could be caused by the redirect, but this is coming from your backend
K0034
K0034OP•4w ago
i think proxy form cloudflare remove some headers
K0034
K0034OP•4w ago
Stack Overflow
Django Cloudflare Proxy "CSRF Verification Failed"
I'm trying to proxy my Django App through Cloudflare via workers. The setup is like so: example.com/app/* forwards to my Django site ~everything else~ forwards to my Webflow site So far that part is
K0034
K0034OP•4w ago
the bug ended up being in the Cloudflare proxy worker code-- the correct Cloudflare proxy worker was addEventListener("fetch", (event) => { event.respondWith(handleRequest(event.request)); }); async function handleRequest(request) { let url = new URL(request.url); // where we're proxying to url.hostname = "fluent-spring.uc.r.appspot.com"; const newRequest = new Request(url.href, request); newRequest.headers.set("Referer", url.href); return await fetch(newRequest); } not sure where I should change thatr Fixed On Django side Thanks a lot @DaniFoldi
Want results from more Discord servers?
Add your server