How to get the URL requested from API Gateway / Lambda?

I’ve been deploying more and more of my architecture onto Serverless / AWS Lambda and am loving it so far. However I have just run into an edge case using Node / Express.

Lets say I receive a request via API Gateway:


In my express app I’m grabbing the full path via req.originalUrl

On my local server using sls offline, the originalUrl comes out intact as entered in the address bar.

But for some reason when I deploy live the express app is receiving the originalUrl with parameters in a different order. e.g. it might come out as my.lambda/?marco=polo&foo=bar

…Almost like API Gateway has massaged the URL, to perform some validation etc.

Am I imagining this? Or is this a known “feature” of API Gateway?

I need the original URL, un-massaged - is there any way to get this?