Re: Check if external url exists with standard Apache directives

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

 



Hi Yehuda,

Thanks for your answer and... yep, I can't change the 'destination' server.
Nevertheless this is an interesting answer, because it is first one near the solution I was looking for.

Anyway, may be there is a problem with the order of execution.
I mean, as far as I read, this solution is based on an apache "load balancer" feature and I'm not sure we can define the order wherewith origin and destination servers will be used.
I must execute the first request on 'destination' server and, only if the resource is not found, I could try with 'origin'.

Just for sake of curiosity I'll try to implement it in my test env.

Thanks again for your answer,
Vincenzo



2013/5/21 Yehuda Katz <yehuda@xxxxxxxxxx>
Your question looks similar to this StackOverflow question: http://serverfault.com/questions/83099/apache2-mod-proxy-w-multiple-reverse-proxies

I am guessing from your question that you can't even change that much on the 'destination' server.
I have also looked for a way to do this and come up empty.

- Y


On Tue, May 21, 2013 at 4:17 AM, Vincenzo D'Amore <v.damore@xxxxxxxxx> wrote:
Hi all,

I'm moving a big directory of images from an HTTP server to another and I cannot change any configuration. I would like my users don't even suppose there is a moving in progress. So I thought to add a new Apache httpd server 2.2 configured as reverse proxy in front of both of those servers.

Let me say, we can call those servers 'origin' and 'destination'.

Apache when a resource does not exists in the destination should try to get it in the origin server.

I suppose to do this check, I mean if the resource exist or not in 'destination' server, using mod_rewrite, I mean RewriteCond -U option.

Actually my tentative has failed, it seems impossible check the existence of external resource using only standard apache 2.2 directives.
This is my tentative:

    RewriteCond %{IS_SUBREQ}    true
    RewriteCond %{REQUEST_FILENAME} ^/destination
    RewriteRule .       http://destination-server%{REQUEST_FILENAME} [P,L]

    # Check "destination" requests
    RewriteCond %{IS_SUBREQ}    false
    RewriteCond "/destination%{REQUEST_FILENAME}" -U
    RewriteRule . http://destination-server%{REQUEST_FILENAME} [P,L]

    RewriteCond %{IS_SUBREQ}    false
    RewriteRule .            http://origin-server%{REQUEST_URI}      [P,L]


Is there any way to do this using mod_rewrite or some standard Apache httpd module?

Ciao,
Vincenzo






--
Vincenzo D'Amore
email: v.damore@xxxxxxxxx
skype: free.dev
mobile: +39 349 8513251

[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