sst.dev icon indicating copy to clipboard operation
sst.dev copied to clipboard

Configure CORS on note-app-client for INCOMING requests

Open petewilcock opened this issue 6 years ago • 3 comments

I've read countless pages talking about setting up a request proxy for the app-client TO an external API.

What I'm doing from the app on localhost:3000 is calling APIGateway which 302 redirects back to my app on localhost:3000, but throws a CORS error because the development server isn't emitting CORS headers.

I can't find a way to do this in a context that makes sense to me in terms of how this app is configured. I suspect it's some permutation of the header config here: https://webpack.js.org/configuration/dev-server/#devserverheaders- but various references assume too much knowledge of React so I'd really appreciate a note on how to configure the app-client portion of this course to respond with CORS appropriately.

petewilcock avatar Aug 26 '19 11:08 petewilcock

Hmm I'm not sure I understand. Since the frontend is a static webpage, what does the redirect accomplish? Are you trying to show the user a message that the request was completed?

jayair avatar Sep 02 '19 17:09 jayair

In this example the React app is the start and finish of an oAuth flow, the callback to which hits lamdba via apigateway and returns a 302 back to the app.

302 fails on local testing due to lack of cors emission on the dev server.

petewilcock avatar Sep 02 '19 17:09 petewilcock

Sorry I don't have too much experience with this. Where are you seeing this error? In Lambda?

jayair avatar Sep 02 '19 17:09 jayair