On Jan 7, 2008 8:06 AM, Andreas Jung <lists@zopyx.com> wrote:
--On 7. Januar 2008 08:00:27 -0600 David Chelimsky <dchelimsky@gmail.com> wrote:
Hi,
I want to show different things to different viewers based on their IP addresses. How can I do this?
Basically you look at the clients ip address (from the REQUEST object) and perform any action you need (redirections, conditions within scripts, templates)...but no idea what the sense of this usecase is. If you have different audiences, setup sites with different content or something similar. In addition: using Zope behind proxy will lead in request coming from the IP address of your reverse proxy. Additional configuration/programming is necessary to get hold of the original IP.
Thanks for the reply. The use case is that my client wants to block a range of IP addresses from being able to view their site. So I need to access the originating IP address and filter appropriately. I've written a few custom zope products before, but I've not done anything that really modifies zope's behaviour on every request - just on requests for the specific objects I'm publishing. So I'm familiar with the request object, but I don't know how to intercept *every* request. Are there any global request life-cycle hooks? If you can point me to those that would be a great help. Cheers, David
--On 7. Januar 2008 08:18:14 -0600 David Chelimsky <dchelimsky@gmail.com> wrote:
On Jan 7, 2008 8:06 AM, Andreas Jung <lists@zopyx.com> wrote:
--On 7. Januar 2008 08:00:27 -0600 David Chelimsky <dchelimsky@gmail.com> wrote:
Hi,
I want to show different things to different viewers based on their IP addresses. How can I do this?
Basically you look at the clients ip address (from the REQUEST object) and perform any action you need (redirections, conditions within scripts, templates)...but no idea what the sense of this usecase is. If you have different audiences, setup sites with different content or something similar. In addition: using Zope behind proxy will lead in request coming from the IP address of your reverse proxy. Additional configuration/programming is necessary to get hold of the original IP.
Thanks for the reply.
The use case is that my client wants to block a range of IP addresses from being able to view their site.
You have a firewall for this purpose or you use apache rewrite rules for performing URL rewriting. -aj
On Jan 7, 2008, at 9:18 AM, David Chelimsky wrote:
On Jan 7, 2008 8:06 AM, Andreas Jung <lists@zopyx.com> wrote:
--On 7. Januar 2008 08:00:27 -0600 David Chelimsky <dchelimsky@gmail.com
wrote:
Hi,
I want to show different things to different viewers based on their IP addresses. How can I do this?
Basically you look at the clients ip address (from the REQUEST object) and perform any action you need (redirections, conditions within scripts, templates)...but no idea what the sense of this usecase is. If you have different audiences, setup sites with different content or something similar. In addition: using Zope behind proxy will lead in request coming from the IP address of your reverse proxy. Additional configuration/programming is necessary to get hold of the original IP.
Thanks for the reply.
The use case is that my client wants to block a range of IP addresses from being able to view their site. So I need to access the originating IP address and filter appropriately.
I've written a few custom zope products before, but I've not done anything that really modifies zope's behaviour on every request - just on requests for the specific objects I'm publishing. So I'm familiar with the request object, but I don't know how to intercept *every* request. Are there any global request life-cycle hooks? If you can point me to those that would be a great help.
Cheers, David
If you just need to redirect traffic from an IP range, and not do anything fancy, it may be better to do it in Apache rather than Zope. http://wiki.zope.org/zope2/ZopeAndApache Tom
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
(Mon, Jan 07, 2008 at 08:18:14AM -0600) David Chelimsky wrote/schrieb/egrapse:
The use case is that my client wants to block a range of IP addresses from being able to view their site. So I need to access the originating IP address and filter appropriately.
You might also want to look at http://betabug.ch/wiki/HoneyPotBL which is a module that accesses the projecthoneypot.org HTTP blacklist database. The actual code to block access is not in this module (as I believe it's application specific), but anyway it might be interesting. Regards, Sascha
participants (4)
-
Andreas Jung -
David Chelimsky -
Sascha Welter -
Tom Von Lahndorff