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

118
Visualizações
Serverless -- Access-Control-Allow-Origin -- on OPTIONS response but not POST response

I have a HTTP API set up in serverless

betaEmailApi:
    name: beta-email-api
    handler: dist/betaEmail.handler
    events:
      - http:
          path: /v1.0/betaEmail
          method: post
          cors: true

Within the API I'm returning the required headers

{
     headers: {
         'Access-Control-Allow-Origin': '*',
     },
}

For a small subset of users - the Access-Control-Allow-Origin header is present on the OPTIONS response but not the preceding POST.

I've added to a gist here the HAR file snippet - where it shows it correctly getting a response of Access-Control-Allow-Origin for OPTIONS but not POST https://gist.github.com/jake-owen-p/7a47d03d65e969c9e2b694d827f267c3

Access-Control-Allow-Origin not being there is causing cors errors - as its only for a small subset of users I'm unsure

Side Questions

  • The connection number is not persisting between the OPTIONS and POST - could that be causing the issue?
  • I've seen it work for HTTP2 - can HTTP1 be the problem?
about 4 years ago · Juan Pablo Isaza
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