Issue
I am working on a mobile app that will get some information from 3rd party API. API only accepts requests from certain IPs, that's why I am trying to build a proxy server that will work like below:
A -> Mobile Clients (IP: 1.1.1.1)
B -> Proxy Server (IP: 2.2.2.2)
C -> 3rd Party API (myapisite.com/*)
Basically, every request from A to C needs to go through B since C only accepts requests from B's IP. I've tried to build it via HAProxy but couldn't manage with domain names. I need a routing mechanism like below:
HTTP requests to 2.2.2.2/myapi should be forwarded to myapisite.com/api
HTTP requests to 2.2.2.2/myotherapi should be forwarded to myapisite.com/otherapi
What would be the simplest solution? Right now, I am thinking about using Ubuntu as a proxy server.
Solution
Minimal config
listen fe_http
mode tcp
timeout client 60s
timeout connect 2s
timeout server 5s
bind :::80 v4v6
server destservr myapisite.com:80 check
Answered By - Aleksandar Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.