sankar.suda
sankar.suda

Reputation: 1147

Create proxy solution using AWS Lambda

I have a case where I want to remove cookie in the request and send the request to another server and display response to the end user.

Example: client -> x.website.com -> remove cookie -> y.website.com

Current solution: client -> x.website.com -> ec2 instance, nginx proxy, remove cookie -> y.website.com

I want to remove ec2 instance in the middle as it's expensive.

Is any way I can achieve using AWS Resources?

Upvotes: 2

Views: 10117

Answers (2)

Ashan
Ashan

Reputation: 19748

There are multiple solutions to address your use case recommended in order.

  1. Using AWS CloudFront as a proxy where you can you can add the y.website.com as a origin and also configure not to forward the cookies.
  2. Using AWS API Gateway & Mapping templates to only map other headers excluding cookie header, and proxy the y.website.com.
  3. Using API Gateway and Lambda Proxy where you need to write a code to exclude the header and forward the request to y.website.com.

Upvotes: 8

Tom Melo
Tom Melo

Reputation: 1499

Did you try to implement something already?

That may work:

[Request]
client -> API Gateway -> AWS Lambda(Forward the Request) -> y.website.com

[Response]
client <- API Gateway <- AWS Lambda(Response) <- y.website.com

https://aws.amazon.com/api-gateway/details

https://aws.amazon.com/lambda/details

Upvotes: 0

Related Questions