I was recently asked to add a CORS directive to an API with several months on production, sure, no problem, piece of cake!
WRONG! CORS headers are not working, damn it! everything looks ok, but what’s the problem then? Cached responses.
Turns out the cache service we have alongside our load balancer, varnish, which allows you to cache some responses in order to make your services quicker and serve when available those responses, was causing that the Allowed-Origin header was always the same.
Long story short, Varnish allows you to add a response header specifying which other headers vary so it can cache different responses per Allowed-Origin.
Knowing you have a cache service and making the most out of it is your responsibility, no, I’m not talking to the developer, nor the DevOps, nor the operations guys, its responsibility of you ALL, to get involved, to know what everyone is up to, what is happening with your product and how everyone is trying to make it better.
One piece of infrastructure can change the way you built your code, the way you layout your API, the headers you add, how you monitor stuff, which metrics you expose, you need to know where your code runs, how it interacts with other layers
But why?
Is it exciting?
Yes! I have been doing this for a decent amount of time, I have worked on production systems using from Java 1.4 to Java 9, going thru Dynamic C, PHP (yes, sorry about this), Ruby, Scala, Go, Chef, Terraform, Cloud Formation, Vagrant, Docker. The point is I’m not talking about a newly found excitement, I get bored sometimes like we all do and I get excited again when I discover new stuff, but how would you discover new stuff if you are always doing the same?
That is your opportunity, to dig in, to find out, to try new things, probably things you already have available and are not using.
Does it make you better?
You are learning, learning will always make you better, you’ll start thinking bigger, wider, your solutions will be better, but this is not only about being a better programmer/devops/operations guy
Empathy?
Hopefully, in time you will understand the pain it involves to maintain infrastructure, you will know how hard it is to scale a bad solution and how easy it is to do so for one built correctly.
You will all learn to talk the same language and ultimately you will have a better relationship with your co-workers
Does it make the product better?
Definitely! When you are aware of the entire picture and how all the pieces come together you will be able to leverage every piece you can, that can make a huge difference on the current product and how can other systems interact with yours but also on how can you move forward to a bigger and better product.




