|
/
Zope
/
Apsis
/
Pound Mailing List
/
Archive
/
2008
/
2008-12
/
Redirecting HTTPS to HTTP
[
Timeout vs Client / "Anthony L" ... ]
[
High Availability with Pound and SSL / ... ]
Redirecting HTTPS to HTTP
Jon Garvin <jgarvin.lists(at)gmail.com> |
2008-12-09 00:05:53 |
[ FULL ]
|
Re: [Pound Mailing List] Redirecting HTTPS to HTTP
Jon Garvin <jgarvin.lists(at)gmail.com> |
2008-12-09 19:11:20 |
[ FULL ]
|
Jon Garvin wrote:[...]
Well, I guess it would help if I was on the latest version of Pound, AND
setup my config correctly. I was stuck on trying to figure out how to
create a URL pattern that would match anything BUT a particular
pattern. Finally realized to move the URL pattern into the other
Service block that points to the back end, and then put the Service
block that does the redirect after that so that anything that falls
through redirects. So, now this works exactly like I want, redirecting
all requests not in the 'secure' directory back to HTTP, while
maintaining the rest of their path.
Service
HeadRequire "Host:\s*www\.myserver\.org.*"
URL "^/secure.*"
BackEnd
Address 127.0.0.1
Port 3001
End
End
Service
HeadRequire "Host:\s*(www\.)?myserver\.org.*"
Redirect "http://www.myserver.org"
End
[...]
|
|
|
Re: [Pound Mailing List] Redirecting HTTPS to HTTP
Dave Steinberg <dave(at)redterror.net> |
2008-12-09 19:44:42 |
[ FULL ]
|
Finally realized to move the URL pattern into the other[...]
That's a good technique, and I'm glad you got it sorted out. This is a
larger issue though - pound doesn't have a negation operator on its
regular expressions. For instance in perl you could do:
! $foo =~ /bar/
or
$foo !~ /bar/
equivalently. Writing a "positive" regexp for a negative meaning turns
out to be a very annoying problem. I guess you could do it as:
$foo =~ /[^b][^a][^r]/
but for more complex matches the increase in complexity is disheartening.
Regards,[...]
|
|
|
Re: [Pound Mailing List] Redirecting HTTPS to HTTP
onlinechess(at)gmail.com |
2008-12-09 21:27:52 |
[ FULL ]
|
> I was stuck on trying to figure out how to[...]
You can use the negative lookahead for that. Here's part of our pound.cfg
that redirects based on the user agent (known scrapers and spam bots),
except for certain urls:
Service "scrapers"
URL "^/(?!access_restricted\.htm)"
URL "^/(?!contact\.pl)"
URL "^/(?!img/)"
URL "^/(?!.+\.css)"
URL "^/(?!.+\.js)"
HeadRequire "User-Agent:.*(Microsoft URL Control|Microsoft
Office|Wget|curl|AdobeAIR|Apache|Brutus|ColdFusion|DataCha0s|DTS
Agent|BackStreet Browser|Firebat|Web Downloader|Offline
Explorer|Internet-exprorer|Indy Library|Gigamega|compatible ;
MSIE|EmailCollector|LiteFinder|Missigua|MJ12bot|Nutch|OCP
HRS|Jenaie|libwww|HistoryHound|HttpClient|HTTrack|HTTP
Fetcher|Snoopy|WebCopier|XMLHTTP)"
Redirect "http://XXXXXXXX/access_restricted.htm<http://xxxxxxxx/access_restricted.htm>
"
End
Personally, what I really wish pound config supported is an OR flag for URLs
(Apache mod_rewrite style). So instead of writing something like:
URL "^/(blah-one|blah-two|blah-three|foo-\n+|.........)\.pl"
I could write a more readable, and in turn less prone to mis-configuration
issues once you get a few dozens of URLs in the list, way:
URL "^/blah-one\.pl" [OR]
URL "^/blah-two\.pl" [OR]
URL "^/blah-three\.pl" [OR]
...........
Or is there already a way to do just that that I'm not aware of?
-Mike
|
|
|
|
|
|