title: How to implement a transparent proxy over akka http
body: <p>I need to implement a lightweight sharding service over http using <a href="https://doc.akka.io/docs/akka-http/current/" rel="nofollow noreferrer">AKKA HTTP</a>. To illustrate the idea please let me introduce a fake service with only one REST resource list called <strong>/users/</strong>. Customer can create new users by POSTing to the list, or query existing useers by its ID  <strong>/users/:userID</strong>.</p>
  
  <p>The sharding service simply routes to the right shard (concrete service). For POST it creates a new ID and decides which service will handle, for GET or DELETE it gets the ID of the user and routes to the one handling it.</p>
  
  <p>The following image shows how it works.
  <a href="https://i.stack.imgur.com/g2BCU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g2BCU.png" alt="enter image description here"></a></p>
  
  <p>I am new to the AKKA HTTP framework, but given the concrete service is already implemented, I just have to implement a sort of transparent proxy in front that will take requests from client, and then forwards the right concrete service according to the routing strategy. 
  <strong>Is there any simple implementation in akka that does just that?</strong></p>