Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda