Have you ever seen so many?

As you have noticed I continue to trail off the paved path of the technically inclined blog and venture into hiking/mountaineering Internet backcountry. The reason is I’m an extremely lazy guy who promised to get back to Shasta almost a year ago. It’s time to be back as promised!

Why this post in this blog? – I am generally trying to keep this blog technically inclined. Researching information on one day mt. Whitney hike I was able to find bits of useful information here and there but no ‘end-to-end product’ so to say. This post is an attempt to decrease amount of googling you need to do. Plus doing this hike in one day wasn’t a cakewalk so quite naturally I need to brag a bit, please bear with me.

Disclaimer – use the information as well as anything you find on the Internet as a baseline. Mountaineering is an inherently dangerous activity. Be prepared, be cautious and be lucky. No book or Internet publication is able to provide you with a hands on experience.

Recently I was investigating quite an interesting issue – there is Ubuntu based VM our testers run some tests on. It was reported they’re unable to log into the virtual machine. After a brief investigation it became clear the issue is not network or SSH key related.

This is quite common nowadays to have some TLS terminatin reverse proxy in front of your REST API. Nginx is being used frequently for this purpose.

The problem I faced and spent some time trying to resolve is that API backing Nginx responds in JSON, but if something is wrong with the request itself or Nginx can’t reach the backend Nginx returns error page in ‘text/html’.

Basically what I was trying to do is to make nginx respond ‘application/json’ on 502 errors, when no backends is reachable and on 400 errors, when someone tries to get plain HTTP response on 443 port. Other errors are expected to be reported by API itself.