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

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews