diff --git a/apps/web/src/components/navbar/navbar.tsx b/apps/web/src/components/navbar/navbar.tsx
index 1ef0aa20e9b1e304f86db5130e04e77410552e33..aead53e59131a5888c441b24ea76f9065d5fe50e 100644
--- a/apps/web/src/components/navbar/navbar.tsx
+++ b/apps/web/src/components/navbar/navbar.tsx
@@ -105,8 +105,8 @@ export const Navbar = () => {
                   <DropdownItem
                     value="Log out"
                     onClick={() => {
-                      const current = new URL(window.location.href);
-                      location.replace(`${getEnvVariable('GP_AUTH_URL')}if/flow/default-invalidation-flow/?next=${current.toString()}`);
+                      const current = encodeURIComponent(window.location.href);
+                      location.replace(`${getEnvVariable('GP_AUTH_URL')}if/flow/default-invalidation-flow/?next=${current}`);
                     }}
                   />
                   {authCache.authorization?.demoUser?.R && (