CORS Access-Control-Allow-Methods Values
Checker ID: #16
CORS Access-Control-Allow-Methods Values
Define quais ações (verbos) os visitantes autorizados podem realizar na sua API.
Seguindo a lógica de APIs modernas (REST), métodos de manipulação de dados como editar e deletar são necessários. A regra é a transparência: você deve declarar explicitamente quais métodos sua API aceita.
• O cabeçalho Access-Control-Allow-Methods deve estar presente e listar os métodos permitidos.
• Métodos como PUT, PATCH e DELETE são aceitos, desde que listados explicitamente.
HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, HEAD, OPTIONS
Content-Type: text/html; charset=UTF-8
HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Content-Type: text/html; charset=UTF-8
HTTP/1.1 200 OK
Date: Wed, 17 Dec 2025 11:45:00 GMT
Content-Type: text/html; charset=UTF-8
CORS Access-Control-Allow-Methods Values
Aqui o nosso “porteiro” define o que os visitantes autorizados podem fazer no seu website (Ler? Gravar? Deletar?).
Seguindo o princípio de "Menor Privilégio", se um link do seu website serve apenas para ler dados, por que permitir que alguém tente enviar um comando DELETE? Libere apenas os comandos essenciais para o funcionamento do seu website.
• O cabeçalho Access-Control-Allow-Methods deve estar presente e conter apenas os métodos: GET, HEAD, OPTIONS e POST (independente da ordem).
HTTP/1.1 200 OK
Date: Wed, 17 Dec 2025 11:45:00 GMT
Server: nginx/1.18.0
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
Access-Control-Allow-Methods: GET, HEAD, OPTIONS, POST
Last-Modified: Mon, 01 Dec 2025 10:00:00 GMT
ETag: "5f8c-60d4-1a2b"
Cache-Control: max-age=3600
Content-Length: 1540
HTTP/1.1 200 OK
Date: Wed, 17 Dec 2025 11:45:00 GMT
Server: nginx/1.18.0
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
Last-Modified: Mon, 01 Dec 2025 10:00:00 GMT
ETag: "5f8c-60d4-1a2b"
Cache-Control: max-age=3600
Content-Length: 1540
HTTP/1.1 200 OK
Date: Wed, 17 Dec 2025 11:45:00 GMT
Server: nginx/1.18.0
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
Access-Control-Allow-Methods: GET, HEAD, OPTIONS, POST, DELETE
Last-Modified: Mon, 01 Dec 2025 10:00:00 GMT
ETag: "5f8c-60d4-1a2b"
Cache-Control: max-age=3600
Content-Length: 1540
HTTP/1.1 200 OK
Date: Wed, 17 Dec 2025 11:45:00 GMT
Server: nginx/1.18.0
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
Access-Control-Allow-Methods: GET, OPTIONS, POST
Last-Modified: Mon, 01 Dec 2025 10:00:00 GMT
ETag: "5f8c-60d4-1a2b"
Cache-Control: max-age=3600
Content-Length: 1540