Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Getting "Script at 'https://example.com/webworker.js' cannot be accessed from origin www.example.com" even with CNAME redirecting www. to main domain

I'm getting an issue where if I access a website I'm making via www.example.com/page then the browser fails to initialize the web workers.

From what I've read this is expected behaviour for security purposes. And that's fine, but I anticipate some people will be coming to the site via www.example.com while others will just type in example.com, and I'll need both to be able to access all the site's resources.

I figure the easy way to do this is to change www.example.com from an @ record to a CNAME record, redirecting all calls to https://www.example.com/page instead to https://example.com/page

I did that last night, and the TTL on the old record was only 30m, so even the world's slowest DNS caches should have been updated by now.

But if I try to access the site via www.example.com I'm still getting the same domain origin error.

What am I missing here? And most importantly, how can I make this work?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

CNAME records are not HTTP redirects.

The browser looks for www.example.com, makes a DNS lookup for it, and the underlying DNS client gets told that the IP address is the same as example.com's, so it gets example.com's IP address and then makes an HTTP request to that IP address asking for www.example.com.

The origin will still be https://www.example.com.


Configure your HTTP server to issue a 301 Moved Permanently redirect for any requests for www.example.com instead.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!