set baseUrl template variable using middleware