Como Corrigir o Erro CORS: Cabeçalho Access-Control-Allow-Origin Ausente
O erro acontece porque o servidor não envia o cabeçalho Access-Control-Allow-Origin. Adicione o cabeçalho no backend autorizando a origem do frontend.
Procedimentos de diagnóstico prático, explicações de causa-raiz e correções verificadas para desenvolvedores.
O erro acontece porque o servidor não envia o cabeçalho Access-Control-Allow-Origin. Adicione o cabeçalho no backend autorizando a origem do frontend.
A CORS preflight error occurs when your backend fails to return a successful HTTP status (200 OK or 204 No Content) on the automatic preflight HTTP OPTIONS request, or fails to include Access-Control-Allow-Methods and Access-Control-Allow-Headers.
The browser blocked your JavaScript because your server’s Content-Security-Policy (CSP) header does not permit inline scripts or the external domain hosting the script in its script-src directive.
The request succeeds in Postman because Postman does not enforce the browser Same-Origin Policy (SOP). In a web browser, adding an Authorization: Bearer header triggers an automatic CORS preflight (HTTP OPTIONS) probe. If the backend fails the preflight or omits authorization from Access-Control-Allow-Headers, the browser blocks the token before the server ever reads it.
A JWT signature verification failure means the cryptographic hash of the Header + Payload calculated by the receiver does not match the Signature segment attached to the token, almost always caused by a secret key mismatch, algorithm mismatch (HS256 vs RS256), or key formatting errors.
Devices resolve domains differently because they query different recursive resolvers (e.g., local ISP router DNS vs. public 1.1.1.1 or browser-native DoH), adhere to cached records governed by the previous TTL, or have local /etc/hosts overrides.
NXDOMAIN (Non-Existent Domain) means the authoritative nameserver confirmed that no record exists for that domain or subdomain. Common causes include missing A/CNAME records, domain expiration at the registrar, broken NS delegation, or DNSSEC validation failures where the parent DS record points to outdated keys.
Mixed content happens when an initial HTML document is loaded securely over HTTPS, but subresources (scripts, images, stylesheets, iframes, fonts, or AJAX endpoints) are requested using unencrypted HTTP:// URLs.
HTTPS certificate errors occur when the browser cannot establish a cryptographically valid trust path from the server’s certificate to a pre-installed root Certificate Authority (CA), when the certificate has expired, or when the domain name does not match the Subject Alternative Names (SAN) on the certificate.
O código 403 Forbidden informa que o servidor compreendeu a requisição, mas recusa-se a autorizar o acesso por restrição de permissão.
An HTTP 401 Unauthorized response means the target resource requires user authentication and the request either omitted credentials or provided credentials that are expired, revoked, or malformed. By RFC specification, a 401 response must include a WWW-Authenticate header explaining how the client can authenticate.
An HTTP 404 Not Found status means the server found no file or route matching the requested URI path. In Single Page Applications (SPAs), 404s happen on page refresh because the web server looks for a physical file (e.g., /dashboard/index.html) that does not exist. On Linux web hosts, 404s also frequently stem from case-sensitive filenames (e.g. Logo.PNG vs logo.png).
Catastrophic backtracking occurs when a traditional NFA (Nondeterministic Finite Automaton) regex engine encounters an "evil regex" pattern—typically containing nested quantifiers like `(a+)+` or overlapping alternations like `(a|a)+`—evaluating an input string that fails near the end. The engine exhaustively tries every exponential combinatorial permutation (O(2^n) steps) before finally declaring that the string does not match.
Try clearing your query or switching categories. You can also explore our companion tools to inspect your headers, DNS records, or tokens directly.