the url should probably be a config value somewhere? or just define it as absolute url starting with / - it'll work no matter what port trac is running on.