0

A common scenario is two or more services behind a reverse proxy, typically each deployed in a container:

| service 1 |          | service 2 |
           \            /
            \          /
             \        /
             | Proxy  |

Now the two services want to talk to each other. What are the pros/cons of:

  1. Talking directly to each other?
  2. Going through the reverse proxy?

Is there any standard best practice? Any potential security concerns?

1

The question is: why use a proxy to communicate both applications? What is the point or target (support SSL, security, availability between services?

In any case, you need 2 proxies, one in each app, in front of each application, it is the best way to use it.

You can also use tunnels, like SSH tunnel or Stunnel that support TLS

2
  • You've described a service mesh almost. – Piotr Gwiazda Apr 8 at 18:53
  • OP's scenario is basically the main motivation behind service meshes – Layman Apr 9 at 14:07
1

Your challenges are:

  • Service discovery (usually DNS-based, but there are other approaches)
  • Load balancing for multiple instances of services (server-side with a load balancer, or client-side with smart service discovery)
  • Encryption/TLS
  • Retry and circuit breaker

There are few patterns

  • API Gateway routing traffic for API calls not only for external traffic but also internally. Sometimes useful, but there are situations when you expose a "public" API through the gateway only, but not the "private" APIs that are internal-only
  • A service mesh (Istio, LinkerD) - a sidecar is added to each service that is technically a reverse proxy (Envoy) and will handle mTLS/encryption, authentication, tracing, logging, circuit breaker, load balancing etc. The control plane of a service mesh keeps all proxies in sync.
  • Point-to-point communication with client-side load balancing (or none in a simplest situation)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.