Lua - how to get upstream hostname (not IP address)

Hi all,

I’m working on a custom OAuth 1.0a plugin, and need to do some string manipulation with the http method, upstream URL, query string parameters, etc. If you’re familiar with OAuth 1.0a, I’m building the signature base string.

However, I can’t find a way to get the actual hostname that my service redirects to. I’ve hunted through the NGINX API but the closest I’ve gotten is ngx.var.remote_addr, which gives me the IP address of the upstream server. Is there any way to get the actual hostname?