[Zope] PROBLEM: Redirect works properly with IIS but not with Apache
Vitor Varalonga
vpedrosa@ciberbit.pt
Mon, 30 Sep 2002 19:00:10 +0100
--------------C0494764109C6BA86D128360
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Greetings!
Something really weird is happening with my Zope application.
Since I wanted to develop a kind of authentication process to
validate the access to each DTML document, I just created a python
script that is called at the beginning of each document.
The only thing this script does it to check if a certain session
variable exists and if it a consistent value.
If so, then the script does nothing more and returns to the DTML doc.
If not it cause a redirection to a login page.
Something like that:
General DTML document:
---------------------
<dtml-call expr="pyscripts.pyCheckLogin()">
<dtml-var standard_html_header>
(...)
<dtml-var standard_html_footer>
This worked properly when I ran Zope behind IIS.
Now that I transferred my Zope application to another server, this
authentication philosophy stopped working and the only thing that
changed is that Zope is no longer running behind IIS but behind Apache
2.0.
I've exhaustedly debugged the code and this what happens:
- As far as what it is concerned with the Python Script itself,
everything seems to work properly; so when redirection is needed
the python script executes it (or at least it tries - see next
comment);
- No matter what happens with the Python script (redirection or
just return), the control will always return to the DTML doc
which didn't happen while Zope ran behind IIS.
Now... I've managed to detour this problem by changing the general
structure of each DTML doc to the following:
<dtml-if expr="pyscripts.pyCheckLogin()">
<dtml-var standard_html_header>
(...)
<dtml-var standard_html_footer>
</dtml-if>
Which means I also change the script to return 1 when authentication
is valid and O when it's not (redirection).
Still, this intrigues me a lot since there should be a similar behaviour
no matter what Web Server Zope is running behind.
Any suggestion to enlighten me on this X-File?
thanks in advance,
Vitor Varalonga
--------------C0494764109C6BA86D128360
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<tt> Greetings!</tt>
<br><tt></tt> <tt></tt>
<p><tt> Something really weird is happening with my Zope
application.</tt>
<br><tt> Since I wanted to develop a kind of authentication
process to</tt>
<br><tt>validate the access to each DTML document, I just created a python</tt>
<br><tt>script that is called at the beginning of each document.</tt>
<br><tt>The only thing this script does it to check if a certain session</tt>
<br><tt>variable exists and if it a consistent value.</tt>
<br><tt>If so, then the script does nothing more and returns to the DTML
doc.</tt>
<br><tt>If not it cause a redirection to a login page.</tt>
<br><tt>Something like that:</tt><tt></tt>
<p><tt>General DTML document:</tt>
<br><tt>---------------------</tt><tt></tt>
<p><tt><dtml-call expr="pyscripts.pyCheckLogin()"></tt><tt></tt>
<p><tt><dtml-var standard_html_header></tt><tt></tt>
<p><tt>(...)</tt><tt></tt>
<p><tt><dtml-var standard_html_footer></tt>
<br><tt></tt> <tt></tt>
<p><tt> This worked properly when I ran Zope behind IIS.</tt>
<br><tt> Now that I transferred my Zope application to
another server, this</tt>
<br><tt>authentication philosophy stopped working and the only thing that</tt>
<br><tt>changed is that Zope is no longer running behind IIS but behind
Apache</tt>
<br><tt>2.0.</tt>
<br><tt> I've exhaustedly debugged the code and this
what happens:</tt><tt></tt>
<p><tt> - As far as what it is concerned with the Python
Script itself,</tt>
<br><tt> everything seems to work properly;
so when redirection is needed</tt>
<br><tt> the python script executes it (or
at least it tries - see next</tt>
<br><tt> comment);</tt>
<br><tt> - No matter what happens with the Python script
(redirection or</tt>
<br><tt> just return), the control will always
return to the DTML doc</tt>
<br><tt> which didn't happen while Zope ran
behind IIS.</tt>
<br><tt></tt> <tt></tt>
<p><tt>Now... I've managed to detour this problem by changing the general</tt>
<br><tt>structure of each DTML doc to the following:</tt>
<br><tt></tt> <tt></tt>
<p><tt><dtml-if expr="pyscripts.pyCheckLogin()"></tt><tt></tt>
<p><tt> <dtml-var standard_html_header></tt><tt></tt>
<p><tt> (...)</tt><tt></tt>
<p><tt> <dtml-var standard_html_footer></tt><tt></tt>
<p><tt></dtml-if></tt>
<br><tt></tt> <tt></tt>
<p><tt>Which means I also change the script to return 1 when authentication</tt>
<br><tt>is valid and O when it's not (redirection).</tt>
<br><tt>Still, this intrigues me a lot since there should be a similar
behaviour</tt>
<br><tt>no matter what Web Server Zope is running behind.</tt>
<br><tt>Any suggestion to enlighten me on this X-File?</tt>
<br><tt></tt> <tt></tt>
<p><tt>thanks in advance,</tt><tt></tt>
<p><tt>Vitor Varalonga</tt></html>
--------------C0494764109C6BA86D128360--