Thursday, May 30, 2019

redirecting specific url requests, via server or network?

i'm looking for a way to redirect traffic - to particular urls, at that - and to do so via POST requests. i thought i had an idea of how to do this, although now i think i've concluded my first attempt has failed and could use some help coming up with another.

scenario: url 1.2.3.4/modelA requests i want to redirect to 5.6.7.8/modelX

i thought i could turn off the webserver on 1.2.3.4 and run something else to do redirects, like a simply python webserver. however this has a couple of problems.

  1. redirects are actually executed by the requestor; usually a browser will see the 301 then go to the new URL. i thought 1.2.3.4 would just forward the traffic on. however it does not; it just returns the code and the new address to go to.
  2. a payload of data is sent to be worked on (with a result returned); all the 3xx codes turn into a GET. 307 retains the original type, so it can push through a POST. however if i use this, it still leaves problem #1; the requestor in this case doesn't care, as it is not a browser. it's just going to bork on a 307.

my initial hope is that i could construct something here which would not require any change on the requestor side. i'm having trouble even if i try to put something simple in front. ie. maybe i can spin up a load balancer 10.10.10.10 and have them update requests to go to it? however that would only route traffic among 1.2.3.4 and 5.6.7.8 and not do the additional path mapping i require.

i could do a load balancer and write something to live at 5.6.7.8/modelA - although i'm unclear exactly what to put at modelA - i need it to internally, on the server, pass that POST into 5.6.7.8/modelX. maybe that is kind of simply writing an api thing that does that? i'm not an api developer so i am unclear on that, and just trying to get away with redirecting request traffic at the moment.

i assume part of the reason i'm struggling to do this easily is that it would seem rather man in the middle attack like. in any case, i'm hoping you guys have some good ideas for a solution that will do what i would like.



No comments:

Post a Comment