Re: rewrite and/or proxy question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Covener wrote:
On Thu, May 14, 2009 at 6:57 AM, André Warnier <aw@xxxxxxxxxx> wrote:

For example, would the following work, or am I forgetting something, doing
something bad, risk security bypasses, etc.. ?

RewriteCond %{HTTP_HOST} app3.company.com
RewriteRule ^/$ /app3/ [L]
RewriteCond %{HTTP_HOST} app3.company.com
RewriteRule ^/app3/.+$ - [L]
RewriteCond %{HTTP_HOST} app3.company.com
#RewriteRule ^/app1/.+$ - [F]
#RewriteRule ^/app2/.+$ - [F]
   RewriteRule ^/(app1|app2)/ - [F]
RewriteRule ^/(.+)$ /app3/$1 [L]



Your conditions only apply to the immediately following rule, but it
seems like your intent is to have them applied to all of them.
Yes it is my intention to apply each RewriteCond to the 5 following RewriteRule lines. I gather that doesn't work ? Do I have to repeat that RewriteCond once per RewriteRule then (as now modified above), or is there a smarter way of doing that ?


You might simplify by capturing the "app3" on the HTTP_HOST and using
it on the subsequent conditions/rules for ease of maintainability.

I think that my less-regexp-inclined colleagues would consider that more as gratuitious show-off obfuscation on my part however.
;-)
Or do you mean something like :

 # catch all 3 at once

 RewriteCond %{HTTP_HOST} ^(app1|app2|app3).company.com$
 RewriteRule ^/$ /%1/ [L]

 RewriteCond %{HTTP_HOST} ^(app1|app2|app3).company.com$
 RewriteRule ^/%1/.+$ - [L]

...

 RewriteCond %{HTTP_HOST} ^(app1|app2|app3).company.com$
 RewriteRule ^/(.+)$ /%1/$1 [L]

I don't know how to manage the "forbidden" ones that way though.

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux