View Single Post
  #13 (permalink)  
Old 04-19-2006, 11:34 AM
cvidal cvidal is offline
Project Contributor
 
Posts: 136
Default Workaround for /?redirect=0

I found a workaround for ?redirect=0, quick and VERY dirty :-)

First the theory:

The files checking this variable (with code introduced in 3.1) are in JavaScript. Now the default is to redirect. To change the default to redirect=0 do:

su - zimbra
cd apache-tomcat-5.5.15/webapps/zimbra/js

There you will find the following files:

AjaxNewWindow_all.js
Ajax_all.js
zimbraMail/share/view/ZmLogin.js

In all three files you will see the following lines of codes (only once in each):

var match = location.search ? location.search.match(/\bredirect=([01])/) : null;
var redirect = match ? match[1] : null;

For the newbies, this means:
- check if 'redirect=[01]' is part of the location string (first line)
- if it is, set 'redirect' to its value, otherwise set it to null (second line)

To make it work, it is enough to change null by '0', that is:

var redirect = match ? match[1] : '0';

Now the implementation:

If you just change the *.js code it will not work, because Zimbra uses the compressed versions of Ajax_all.js and AjaxNewWindow_all.js, named with the suffix ".zgz". If you uncompress these files, you will see that they have been stripped of all // comments, most \n and empty lines. So, once you have identified the lines to change in the *.js files, do the following:

gunzip -S zgz Ajax_all.js.zgz

This generates the file "Ajax_all.js." (observe the final dot, useful to avoid scratching the original *.js).

Edit Ajax_all.js. and change null to '0'. Then compress it again with:

gzip -S zgz Ajax_all.js.

The same for AjaxNewWindow_all.js.zgz.

ZmLogin has no zgz.

Then restart tomcat (tomcat restart), and in your browser clean the cache and the cookies for your zimbra host.

Probably in the source code there is a script that converts the *.js -> *.js.zgz, but the manual method works fine and fixes the problem in 10 minutes :-))
Reply With Quote