Score:1

How to setup forward proxy on AWS to forward only specific requests to a backconnect proxy?

cn flag

I don't need specifics on this, but I think I am conceptually confused about what I'm trying to do and that's making it hard to do research. Here's the idea:

I have an EC2 instance using NGINX as a reverse proxy. I want all outgoing requests to continue as normal, except I want a forward proxy to forward only specific requests, say example.com, to a backconnect proxy service. How can this be accomplished on AWS, or do I even have the right idea? Do I need a forward proxy or would VPC routing tables be able to accomplish this?

Score:0
in flag

Yes, this can be achieved with an Application Load Balancer in AWS via Host Based Routing

https://aws.amazon.com/blogs/aws/new-host-based-routing-support-for-aws-application-load-balancers/

You can now create Application Load Balancer rules that route incoming traffic based on the domain name specified in the Host header. Requests to api.example.com can be sent to one target group, requests to mobile.example.com to another, and all others (by way of a default rule) can be sent to a third. You can also create rules that combine host-based routing and path-based routing. This would allow you to route requests to api.example.com/production and api.example.com/sandbox to distinct target groups.

The tutorial gives an example configuration, where you configure a Host header, where in your case would be example.com and have it point to a different target group.

This can also be achieved with nginx, but it would be far harder and pointless, when you already have that as a service by AWS

Harrison H avatar
cn flag
Thanks Alex. I realized I was being dumb because the requests I wanted to forward were using python requests, so I could just add the proxy there. I didn't verify your solution.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.