Fix IP address detection bug when behind nginx