GithubHelp home page GithubHelp logo

gateway-cors's Introduction

AWS API gateway origin header missing over http1.1

Making webrequests to a lambda through an aws api gateway includes the origin header among the event headers, but only over http2.

steps to reproduce

i tested this with a global version of serverless

> serverless --version
Framework Core: 3.22.0
Plugin: 6.2.2
SDK: 4.3.2

in repo root:

serverless deploy

then

 invoke-webrequest -HttpVersion 2.0 -Uri "https://<id>.execute-api.eu-west-1.amazonaws.com/test/health/test" -Headers @{"Origin"="https://test.com"}

gives

StatusCode        : 200
StatusDescription : OK
Content           : ok! origin: 'https://test.com'
RawContent        : HTTP/2.0 200 OK

while

 invoke-webrequest -HttpVersion 1.1 -Uri "https://<id>.execute-api.eu-west-1.amazonaws.com/test/health/test" -Headers @{"Origin"="https://test.com"}

gives

StatusCode        : 200
StatusDescription : OK
Content           : ok! origin: 'undefined'
RawContent        : HTTP/1.1 200 OK

similar for curl

curl https://<id>.execute-api.eu-west-1.amazonaws.com/test/health/test -H "Origin: https://test.com" --http2
ok! origin: 'https://test.com'
curl https://<id>.execute-api.eu-west-1.amazonaws.com/test/health/test -H "Origin: https://test.com" --http1.1
ok! origin: 'undefined'

gateway-cors's People

Contributors

zazcallabah avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.