CORS Access-Control-Allow-Methods Values
Checker ID: #16
CORS Access-Control-Allow-Methods Values
Define quais ações (verbos HTTP) os visitantes autorizados podem realizar na sua API.
Seguindo a lógica de APIs modernas (REST), métodos de acesso e manipulação de dados como GET, HEAD, OPTIONS, POST, PUT, PATCH e DELETE são necessários em muitos cenários. A regra aqui é a transparência: declare explicitamente apenas os métodos que sua API realmente aceita.
• O cabeçalho Access-Control-Allow-Methods deve estar presente e listar os métodos HTTP que a API aceita.
• Métodos aceitos (declare apenas os que a sua API realmente usa): GET, HEAD, OPTIONS, POST, PUT, PATCH, DELETE.
• Qualquer combinação dos métodos acima é válida, desde que listada explicitamente.
• O cabeçalho não pode estar ausente.
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
HTTP/1.1 200 OK
Access-Control-Allow-Methods: TRACE
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 servidor (Ler? Gravar? Deletar?).
Seguindo o princípio de “Menor Privilégio”, se um endpoint do seu servidor serve apenas para leitura de dados, por que permitir que alguém tente enviar um comando DELETE? Libere apenas os métodos essenciais para o funcionamento do seu site.
• 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