On Tue, Oct 20, 2009 at 08:02 -0700, KenCorey wrote:
>
> Hiya,
>
> I'm hoping someone can help.
>
> I've successfully been using web.py originally installed with the
> instructions from http://webpy.org/install.
>
> I just got my shiny new https server working. Urls were working on
> both http://clicksafety.co.uk (or http://www.clicksafety.co.uk) and
> https://www.clicksafety.co.uk.
>
> I'd like to use a redirect rule like this:
>
> # This is a mod redirect rule to force www.
> $HTTP["host"] =~ "^clicksafety\.co\.uk$" {
> url.redirect = ( "^/(.*)" => "https://www.clicksafety.co.uk/$1" )
> }
>
> The intent being to force *all* accesses through
> https://www.clicksafety.co.uk.
>
> The problem is that the url is rewritten as "https://
> www.clicksafety.co.uk/testapp.py/testapp.py/", which, of course, fails
> because the url is not recognised. All links are based on this, and
> they fail as well. (If I pull the "/testapp.py/testapp.py" out of
> that URL then the seb site works as before.
>
> It seems as if "REAL_SCRIPT_NAME" needs to be set for redirects, as
> well as rewrites.
>
> Any ideas?
>
> -Ken
Hi Ken,
You can match that hostname with `== "clicksafety.co.uk"' in Lighttpd.
Regarding your problem: that is strange, when you make Lighttpd redirect
it does not do anything with web.py at all, it does not even know if the
URL is legal. I do the same for all my domains, but the other way
around: no www. Here is an excerpt from my config file:
# BEGIN NOPHILOSOPHY
} else $HTTP["host"] == "www.nophilosophy.com" {
url.redirect = ("^/(.*)$" => "http://nophilosophy.com/$1" )
} else $HTTP["host"] == "nophilosophy.com" {
server.document-root = "/a/boao/home/emilia/nophilosophy.com/static"
fastcgi.server = ( "/" =>
(( "bin-path" =>
"/a/boao/home/emilia/nophilosophy.com/code.py",
"socket" => "/tmp/fastcgi-py-nophilosophy.com.socket",
"check-local" => "disable",
"bin-environment" => ("REAL_SCRIPT_NAME" => "")
))
)
# Disable fcgi for resources with an extension (except /sitemap.xml).
$HTTP["url"] =~ "^.+\..{3,4}$" {
$HTTP["url"] != "/sitemap.xml" {
expire.url = ("" => "access 1 days")
fastcgi.server = ()
}
}
# END NOPHILOSOPHY
That part takes care of the nophilosophy.com domain, www. and non-www.
Hope it helps!
Greetings,
Hraban
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---