use target_uri and normalize_uri as well as fix a cookie problem