Fixed a bug when the uri has a trailing slash or no slash after application path