You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Szymon Bakowski <sz...@bakowski.net> on 2008/03/13 11:53:01 UTC
[users@httpd] content being served on the basis on incoming IP
Hi all,
I was just wondering about in order to find a solution to my problem
but haven`t come up with final solution yet: what i am after is to be
able to serve the content of different directories after hitting the
same IP based on incoming IP. I was thinking about mod_proxy but am
not sure if this is the way to follow. Also, SSL may be involved and
here I suppose my idea may possibly fail ? All suggestions more than
welcome.
Cheers.
Simon
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] content being served on the basis on incoming IP
Posted by Szymon Bakowski <sz...@bakowski.net>.
On 13/03/2008, David Cassidy <da...@twocats.co.uk> wrote:
> simon
>
> I think you need to read that rewrite rule closer
> as it will deliver different content to the different users based on IP
> address.
>
> remember rewrite doesn't JUST do re-writing of urls.
> it can internally proxy through to different files for the same request
> based on the rule.
>
> thats whats happening below...
>
>
> D
>
Sorry about that. Let me take a closer look. Thanks David and Nils for
your input. I do appreciate. Will let you know about the outcome.
Cheers.
Simon
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] content being served on the basis on incoming IP
Posted by David Cassidy <da...@twocats.co.uk>.
simon
I think you need to read that rewrite rule closer
as it will deliver different content to the different users based on IP
address.
remember rewrite doesn't JUST do re-writing of urls.
it can internally proxy through to different files for the same request
based on the rule.
thats whats happening below...
D
On Thu, 2008-03-13 at 12:59 +0000, Szymon Bakowski wrote:
> > On Thu, 13 Mar 2008, Szymon Bakowski wrote:
> >
> > > I was just wondering about in order to find a solution to my problem
> > > but haven`t come up with final solution yet: what i am after is to be
> > > able to serve the content of different directories after hitting the
> > > same IP based on incoming IP. I was thinking about mod_proxy but am
> > > not sure if this is the way to follow. Also, SSL may be involved and
> > > here I suppose my idea may possibly fail ? All suggestions more than
> > > welcome.
> >
> >
> > You should be able to match for REMOTE_ADDR in rewrite rules, and take it
> > from there to access different "physical" directories. Say, something
> > like:
> >
> > RewriteCond %{REMOTE_ADDR} 10.1.1.1 [NC]
> > RewriteRule ^/(.*) http://somehost.example.com/dir1/$1
> > [P,L]
> > RewriteCond %{REMOTE_ADDR} 10.1.1.2 [NC]
> > RewriteRule ^/(.*) http://somehost.example.com/dir2/$1
> > [P,L]
> >
>
> Hmm, thats not exactly what i was thinking and I believe mod _rewrite
> may not help here as that is a url rewriter and what I am after to
> serv different content for the same domain based on incoming IP.
>
> Ex.
>
> person with ip 1.1.1.2 hits domain example.com and is getting a red
> circle on the screen where content is being read off
> /htdocs/www/content_for_user_1
>
> person with ip 1.1.1.3 hits domain example.com and is getting a red
> circle on the screen where content is being read off
> /htdocs/www/content_for_user_2 .
>
> I suppose it should do something to do with virtual hosts. problem
> would be sorted by assigning many IP to the same interface
> (subinterface) but I cannot use this option. Single IP has to serve
> different content for different user based on their IP.
>
> is it possible at all ? I do expect problems with SSL but for the
> satrters wanted to sort out http.
>
> Cheers. Simon
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] content being served on the basis on incoming IP
Posted by Nils Jeppe <ni...@pandemonium.de>.
On Thu, 13 Mar 2008, Szymon Bakowski wrote:
> Hmm, thats not exactly what i was thinking and I believe mod _rewrite
> may not help here as that is a url rewriter and what I am after to
> serv different content for the same domain based on incoming IP.
>
> Ex.
>
> person with ip 1.1.1.2 hits domain example.com and is getting a red
> circle on the screen where content is being read off
> /htdocs/www/content_for_user_1
>
> person with ip 1.1.1.3 hits domain example.com and is getting a red
> circle on the screen where content is being read off
> /htdocs/www/content_for_user_2 .
Yes this is exactly what the rewrite rules are supposed to do.
Best wishes,
Nils
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] content being served on the basis on incoming IP
Posted by Szymon Bakowski <sz...@bakowski.net>.
> On Thu, 13 Mar 2008, Szymon Bakowski wrote:
>
> > I was just wondering about in order to find a solution to my problem
> > but haven`t come up with final solution yet: what i am after is to be
> > able to serve the content of different directories after hitting the
> > same IP based on incoming IP. I was thinking about mod_proxy but am
> > not sure if this is the way to follow. Also, SSL may be involved and
> > here I suppose my idea may possibly fail ? All suggestions more than
> > welcome.
>
>
> You should be able to match for REMOTE_ADDR in rewrite rules, and take it
> from there to access different "physical" directories. Say, something
> like:
>
> RewriteCond %{REMOTE_ADDR} 10.1.1.1 [NC]
> RewriteRule ^/(.*) http://somehost.example.com/dir1/$1
> [P,L]
> RewriteCond %{REMOTE_ADDR} 10.1.1.2 [NC]
> RewriteRule ^/(.*) http://somehost.example.com/dir2/$1
> [P,L]
>
Hmm, thats not exactly what i was thinking and I believe mod _rewrite
may not help here as that is a url rewriter and what I am after to
serv different content for the same domain based on incoming IP.
Ex.
person with ip 1.1.1.2 hits domain example.com and is getting a red
circle on the screen where content is being read off
/htdocs/www/content_for_user_1
person with ip 1.1.1.3 hits domain example.com and is getting a red
circle on the screen where content is being read off
/htdocs/www/content_for_user_2 .
I suppose it should do something to do with virtual hosts. problem
would be sorted by assigning many IP to the same interface
(subinterface) but I cannot use this option. Single IP has to serve
different content for different user based on their IP.
is it possible at all ? I do expect problems with SSL but for the
satrters wanted to sort out http.
Cheers. Simon
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] content being served on the basis on incoming IP
Posted by Nils Jeppe <ni...@pandemonium.de>.
On Thu, 13 Mar 2008, Szymon Bakowski wrote:
> I was just wondering about in order to find a solution to my problem
> but haven`t come up with final solution yet: what i am after is to be
> able to serve the content of different directories after hitting the
> same IP based on incoming IP. I was thinking about mod_proxy but am
> not sure if this is the way to follow. Also, SSL may be involved and
> here I suppose my idea may possibly fail ? All suggestions more than
> welcome.
You should be able to match for REMOTE_ADDR in rewrite rules, and take it
from there to access different "physical" directories. Say, something
like:
RewriteCond %{REMOTE_ADDR} 10.1.1.1 [NC]
RewriteRule ^/(.*) http://somehost.example.com/dir1/$1
[P,L]
RewriteCond %{REMOTE_ADDR} 10.1.1.2 [NC]
RewriteRule ^/(.*) http://somehost.example.com/dir2/$1
[P,L]
etc. (You don't "really" need proxying, unless you access another host
of course.) This is from memory, didn't test it. I also think you may be
able to save the remote address to a variable and do something with that
in the "target" url.
Hope this helps.
Best wishes,
Nils
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org