Fixing session refresh logic to allow for absolute URLs