Re: [squid-users] Reverse-proxy for site on Google AppEngine

From: Will <vocalster.app_at_gmail.com>
Date: Mon, 4 Jun 2012 11:22:00 -0700

Thanks for the reply, Amos.

I tried forceddomain=mysite.appspot.com, I got the same behavior.

Perhaps I'm not clear on the problem.

Because in China one cannot directly access a site on Google
AppEngine, I setup an Apache reverse proxy server to my site on GAE,
and it works very well. Now I'm thinking migrating to Squid from
Apache because Squid provides rich caching.

With Eliezer's help, I managed to have the basic reverse-proxy going,
now when people visit 'my.public.domain.com', they get the content of
'mysite.appspot.com' which is on Google AppEngine. However, it only
works for static pages. As soon as you hit a page that requires login,
the browser's address bar shows 'mysite.appspot.com/login' and from
that point on, all traffic goes to 'mysite.appspot.com' directly.

Internally, when one visits a page requires login, the code redirects
to the login page if one hasn't logged in. All path is relative, and
it works for Apache reverse-proxy server.

Any thoughts? Thanks,

I'm using squid 3.1. My squid.conf looks like this,

http_port 80 accel defaultsite=mysite.appspot.com ignore-cc
cache_peer mysite.appspot.com parent 80 0 no-query originserver
forceddomain=mysite.appspot.com login=PASS name=gaeAccel
acl gae dstdomain my.public.domain.name mysite.appspot.com
http_access allow gae
http_access deny all
cache_peer_access gaeAccel allow gae
cache_peer_access gaeAccel deny all

On Fri, Jun 1, 2012 at 7:32 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 2/06/2012 9:50 a.m., Will wrote:
>>
>> Hi Eliezer,
>>
>> Thanks for the excellent explanation.
>>
>> I changed the conf as you suggested, now for all static pages it works
>> great, the address bar shows my.public.domain.com/page1. However, for
>> any pages requiring login, it redirects to 'mysite.appspot.com', the
>> address bar shows mysite.appspot.com/pagelogin, instead of
>> my.public.domain.com/pagelogin which is what I want.
>
>
> The slightly better way is to use "forcedomain=mysite.appspot.com" on the
> cache_peer line. This will force the domain to be that label only when
> passed to the specific peer. Inside Squid you can still handle the public
> name and route pieces of the site around to other servers under the public
> name as needed.
>
>
>
>>
>> One main reason I want to use Squid as a reverse proxy is sites on
>> Google AppEngine is blocked in China by Great Firewall. People in
>> mainland China cannot access anysite.appspot.com directly. Therefore,
>> if squid redirects to mysite.appspot.com, it defeats my main purpose.
>>
>> Any ideas?
>
>
> There is no redirect. What you are doing is URL-rewriting using defaultsite
> to do the re-write.
>
> You should be doing the login at Squid, and passing the credentials as
> needed to the peer.  (cache_peer option "login=PASS" on 3.1 and older,
> "login=PASSTHRU" on 3.2+. exact text in both cases)
>
> Amos
Received on Mon Jun 04 2012 - 18:22:09 MDT

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 12:00:03 MDT