Hi everybody!
I work on an international site which makes use of SSL. The SSL certificate
is signed for mydomain.biz, but multiple DNS entries point to my server (for
example: mydomain.de, mydomain.info, mydomain.fr).
To make sure that everybody ONLY uses mydomain.BIZ, I want to redirect any
other request to my A4D server to the right domain depending on the result
of GET REQUEST INFO("*host") with the following "On Request" event handler
in Active4d.a4l:
<code>
method "On Request"($inURL) `--> Text or <none>
SITE:=get request info("*host")
IP:=get request info("*remote address")
if (SITE # "mydomain.biz" ) //
egal was passiert: immer nur mydomain.biz
redirect("http://mydomain.biz"+full requested url)
else
LANG:=get response cookie("LANG")
// cookie für die Sprache holen
if (LANG="")
// ist da schon was?
LANG:=get request info("Accept-Language") //
nein, also im Request die Sprachunterstützung abfragen
if ( LANG="" )
// nicht mitgeschickt???
LANG:="en"
// dann eben deutsch...
end if
$pos:=position(","; LANG)
// zuerst die Default-Sprache suchen
if ($pos#0)
// mehr als eine Sprache unterstützt?
LANG:=Substring(LANG;1;$pos-1)
// Default-Sprache in LANG
end if
$pos:=position("-"; LANG)
// gibt es sub-Sprachen?
if ($pos#0)
// Sub-Sprache, z.B. de-ch
LANG:=Substring(LANG;1;$pos-1)
// Default-Sprache in LANG
end if
if (not(directory exists("web\\dt\\"+LANG))) //
unterstützen wir diese sprache?
LANG:="en"
end if
set response cookie("LANG";lowercase(LANG))
// cookie speichern, nur kleinbuchstaben
end if
end if
end method
</code>
But in some certain cases, my browsers say "Your browser could not fulfill a
redirect request".
All works well as long as I do not pass a page name in the URL. For example,
browsing to http://www.mydomain.de produces an HTTP 303 (See other) state
and redirects my browsers to mydomain.biz.
But if I browse to http://www.mydomain.de/index.a4d, the 303 (See other)
state is not generated. Instead, A4D returns state 200 (OK), serves the page
and adds the "Your browser could not fulfill a redirect request" message to
the served page.
Is there any advice how I can get hold of that issue? The documentation
states that I may do a redirect in the On Request handler....
Thanks!
Peter
--
Angaben gemäß §35a GmbH-Gesetz:
ITServ GmbH
Sitz der Gesellschaft: 55294 Bodenheim/Rhein
Eingetragen unter Registernummer HRB 41668 beim Amtsgericht Mainz
Vertretungsberechtiger Geschäftsführer: Peter Bauer, 55294 Bodenheim
Umsatzsteuer-ID: DE182270475
_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/