alexslade

alexslade

This is a bit of an exploratory question, and I’d love any thoughts you have. I’m posting early in my research because I think this might be interesting to others, and I suspect I may have an XY problem.

Goal

Something a bit like ExVCR, but running in production and normally just proxying the requests.

Background

My team runs a lot of data integrations, where we work with often janky and awkward external datasources. They are important requests, but low volume and raw response time is not a primary concern. The big problem: they frequently break and it’s a pain to debug them.

We’re exploring the idea of a man-in-the-middle proxy, that will simply receive, log, and forward events to our API most of them time.

But when we need to, we can turn on interception for some set of urls. Maybe to respond with a previously saved response, or a modified one. Or to simply direct some set of requests to a different host for dev/debugging.

Here’s a real example:

  • We receive POST requests from an oracle service for a kind of SSO
  • We process that data and return a redirect url (in XML) to that request

One day, that request starts failing for some of our customers. We later find out that it was because oracle changed how they parsed XML and now needed URLs inside the XML to be URLescaped (not previously the case).

It took a few days of back and forth to solve this, and really what we wanted was the ability to quickly see and mess with requests that were in flight.

We would do this in a staging/preview environment, rarely on production, but there are use cases when we might want to do it in production. For instance, we have a partner who cannot connect to our preview env, they only support a single endpoint (which is prod).

One approach would be something like nginx, with a configurable “forward” address depending on some matchers (e.g. forward some requests to this temporary URL for debugging), but really we’d like some more control than this.

So I’m looking for pointers, and I’m hoping that there is something obvious like a way to cache a plug conn, and then pipe that back into req with some modifications…

:heart: for any advice

Showing Posts 1 to 2

felix-starman

felix-starman

I’ll edit my comment later since I’m on a phone it’s a bit late here but I have meddled with something similar for a mocking library but realized it could be useful in other scenarios, like what you mention.

I’ll put a link to the branch and repositories to give you a starting point if it’s something that you’re interested in, but it is basically a wrapper/spy that you can program.

There’s also a ruby library called suture by a company called testdouble that does something kind of similar to what you were mentioning, although their approach is more for mechanisms to refactor nasty code

felix-starman

felix-starman

You might also benefit from opentelemetry, instrumenting your integrations, and then using a service like HoneyComb to visualize the data.

Honeycomb with opentelemetry has been a game changer for us when finding bugs

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews