I created a router that protects pages from members who don’t have some credential.
The code works as expected on live website.
The code does not work on preview because it not possible to simulate those credential in preview. That cumbersome but I understandable.
BUT
The router kicks in while in the editor , redirecting me when I try to edit a page protected!
Video
Live demo
I know this feature is not the most used but if think this is a pretty big issue for the editor
Are you aware of it?
Are you going to do something about it?
2 Likes
Anyone from the editor team available? 
@plomteuxquentin Hi. Thank you for a quite comprehensive description. Indeed, this behavior doesn’t look logical. Router function works every time when you navigate to the router page in editor. I’ve send this to our development team to see if it is possible to change.
Meanwhile, to be able to edit your protected page (which is currently doing the redirect), please either comment out the line with
return ok();
inside router() function, or change first argument to be the page you want to edit
Please let me know if it helps
Regards, Alex
Hi @aleksander-denga , thx for pushing that issue to the right team 
I already use that workaround, but for the sake of my client who need to edit the pages I would rather not need to use this hack.
Do you have any ETA? If not could you notify me once the issue is fixed? 
@plomteuxquentin Hi. Nope, we don’t have ETA on this yet.
Can’t promise a quick fix here, but I’ll update you once we have it.
Thank you.
Hi @plomteuxquentin
A small update regarding your question.
Our developers confirmed that this is the way the router function will work further.
This was also documented in the corresponding API section for future reference.
I think you can workaround this issue with wrapping the ok() function into an if statement, verifying the origin of requested url. And if this url contains “editor.wix.com” (meaning you’re in the edit mode), then redirect you to specific router page (which is again, can be recognized based on the requested path).
Please let me know if you this helps.
Regards, Alex
Hi Alex,
Yes this is a good hack but an hack nonetheless 
But I understand that it is hard to fix since every router has its own logic…
Thx you for the update
@plomteuxquentin Hi I’m a javaScript developer and I ran across this bug while evaluating wix for a client project. Is this typical for Wix support? “Just add a hack-we’re not going to change it” My confidence in the platform is dwindling