How to set up a reverse proxy for login.facebook.com

Hi, Apache gurus!

I am trying to set up a reverse proxy for facebook by using Apache
mod_proxy and mod_proxy_html.

......
ProxyRequests off
SetOutputFilter proxy-html
ProxyHTMLInterp On
.......
SSLEngine on
SSLProxyEngine on
SSLProxyVerify none
.......
ProxyPass /13/ http://www.facebook.com/
ProxyPassReverse /13/ http://www.facebook.com/
<Location /13/>
RequestHeader unset Accept-Encoding
ProxyHTMLURLMap http://www.facebook.com https://${myip}:8381/13 V
ProxyHTMLURLMap https://login.facebook.com https://${myip}:8381/15 V
ProxyHTMLURLMap / /13/
</Location>

ProxyPass /15/ https://login.facebook.com/
ProxyPassReverse /15/ https://login.facebook.com/
<Location /15/>
RequestHeader unset Accept-Encoding
ProxyHTMLURLMap http://www.facebook.com https://${myip}:8381/13 V
ProxyHTMLURLMap https://login.facebook.com https://${myip}:8381/15 V
ProxyHTMLURLMap / /15/
</Location>



Now, when I enter https://myip:8381/13/, it goes to
http://www.facebook.com. That is fine.
when I enter my user name and password, it goes to
https://myip:8381/15/ which is https://login.facebook.com. That is
fine.
But the message is login failed. Cookie requred.

The following is the httpd-error.log

......
Sat Feb 06 16:47:38 2010] [info] Subsequent (No.2) HTTPS request
received for child 0 (server [myhost]:8381)
[Sat Feb 06 16:47:38 2010] [info] [client 99.234.146.143] Non-proxy
request; not inserting proxy-html filter, refere is
https://[myip]:8381/15/login.php?login_attempt=1
[Sat Feb 06 16:47:43 2010] [debug] ssl_engine_io.c(1869): OpenSSL: I/O
error, 5 bytes expected to read on BIO#29479e00 [mem: 29493000]
[Sat Feb 06 16:47:43 2010] [info] [client 99.234.146.143] (70007)The
timeout specified has expired: SSL input filter read failed.
[Sat Feb 06 16:47:43 2010] [debug] ssl_engine_kernel.c(1893): OpenSSL:
Write: SSL negotiation finished successfully
[Sat Feb 06 16:47:43 2010] [info] [client 99.234.146.143] Connection
closed to child 0 with standard shutdown (server [myhost]:8381)


Before, it always complain missing a file called ua_callback.php
I wget it from http://m.facebook.com. It looks like a html file
instead of a php file.
I do not know all about this.

This is the ua_callback.php

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Page Not Found
| Facebook</title><meta name="description" content="Facebook helps you
connect and sha
re with the people in your life." /> <link type="text/css"
rel="stylesheet"
href="http://static.ak.fbcdn.net/rsrc.php/z5A91/hash/d8olu30 z.css" />
</head><body><div id="fb_header" class="marquee"><table
width="100%"><tr><td align="left" style="width:50%"><img height="22"
width="79" id="facebook_logo" al
t="facebook" src="http://static.ak.fbcdn.net/rsrc.php/zCFHB/hash/ar61o5cw .png"
/></td></tr></table></div><div id="title" class="pad"><b>Page Not
Found</b></d
iv><div class="pad"><div class="section border_top">The page you
requested was not found. Click here to return
home.</div></div><div
id="footer" class="pad"><div class="section border_bottom"><div
class="section_title">Language</div><form
action="/a/preferences.php?refid=0" method="post"><
input type="hidden" name="post_form_id"
value="08299258565f634a43f36529a7371010" /><select
name="locale"><option value="af_ZA">Afrikaans</option><option valu
e="id_ID">Bahasa Indonesia</option><option value="ms_MY">Bahasa
Melayu</option><option value="ca_ES">Catal\xc3\xa0</option><option
value="cs_CZ">\xc4\x8ce\xc
5\xa1tina</option><option value="cy_GB">Cymraeg</option><option
value="da_DK">Dansk</option><option
value="de_DE">Deutsch</option><option value="en_GB">Engli
sh (UK)</option><option value="en_US" selected="1">English
(US)</option><option value="en_UD">English (Upside
Down)</option><option value="es_LA">Espa\xc3\xb
1ol</option><option value="es_ES">Espa\xc3\xb1ol
(Espa\xc3\xb1a)</option><option value="tl_PH">Filipino</option><option
value="fr_CA">Fran\xc3\xa7ais (Canada
)</option><option value="fr_FR">Fran\xc3\xa7ais
(France)</option><option
value="ko_KR">\xed\x95\x9c\xea\xb5\xad\xec\x96\xb4</option><option
value="hr_HR">Hrv
atski</option><option value="it_IT">Italiano</option><option
value="lt_LT">Lietuvi\xc5\xb3</option><option
value="hu_HU">Magyar</option><option value="nl_NL"
>Nederlands</option><option value="ja_JP">\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e</option><option value="nb_NO">Norsk (bokm\xc3\xa5l)</option><option value="pl_
PL">Polski</option><option value="pt_BR">Portugu\xc3\xaas
(Brasil)</option><option value="pt_PT">Portugu\xc3\xaas
(Portugal)</option><option value="ro_RO">Ro
m\xc3\xa2n\xc4\x83</option><option
value="ru_RU">\xd0\xa0\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\x b8\xd0\xb9</option><option
value="sk_SK">Sloven\xc4\x8dina</op
tion><option value="sl_SI">Sloven\xc5\xa1\xc4\x8dina</option><option
value="fi_FI">Suomi</option><option
value="sv_SE">Svenska</option><option value="th_TH">
\xe0\xb8\xa0\xe0\xb8\xb2\xe0\xb8\xa9\xe0\xb8\xb2\xe0\xb9\x84 \xe0\xb8\x97\xe0\xb8\xa2</option><option
value="vi_VN">Ti\xe1\xba\xbfng Vi\xe1\xbb\x87t</option><
option value="tr_TR">T\xc3\xbcrk\xc3\xa7e</option><option
value="zh_CN">\xe4\xb8\xad\xe6\x96\x87(\xe7\xae\x80\xe4\xbd\ x93)</option><option
value="zh_TW">\xe4
\xb8\xad\xe6\x96\x87(\xe5\x8f\xb0\xe7\x81\xa3)</option><option
value="zh_HK">\xe4\xb8\xad\xe6\x96\x87(\xe9\xa6\x99\xe6\xb8\ xaf)</option><option
value="el_GR"
>\xce\x95\xce\xbb\xce\xbb\xce\xb7\xce\xbd\xce\xb9\xce\xba\xc e\xac</option><option value="bg_BG"> \xd0\x91\xd1\x8a\xd0\xbb\xd0\xb3\xd0\xb0\xd1\x80\xd1\x81\xd0 \
xba\xd0\xb8</option><option
value="sr_RS">\xd0\xa1\xd1\x80\xd0\xbf\xd1\x81\xd0\xba\xd0\x b8</option><option
value="he_IL">\xd7\xa2\xd7\x91\xd7\xa8\xd7\x99\xd7
\xaa</option><option
value="ar_AR">\xd8\xa7\xd9\x84\xd8\xb9\xd8\xb1\xd8\xa8\xd9\x 8a\xd8\xa9</option><option
value="hi_IN">\xe0\xa4\xb9\xe0\xa4\xbf\xe0\xa4\xa
8\xe0\xa5\x8d\xe0\xa4\xa6\xe0\xa5\x80</option><option
value="bn_IN">\xe0\xa6\xac\xe0\xa6\xbe\xe0\xa6\x82\xe0\xa6\x b2\xe0\xa6\xbe</option><option
value="pa_IN
">\xe0\xa8\xaa\xe0\xa9\xb0\xe0\xa8\x9c\xe0\xa8\xbe\xe0\xa8\x ac\xe0\xa9\x80</option><option
value="ta_IN">\xe0\xae\xa4\xe0\xae\xae\xe0\xae\xbf\xe0\xae\x b4\xe0
\xaf\x8d</option><option
value="te_IN">\xe0\xb0\xa4\xe0\xb1\x86\xe0\xb0\xb2\xe0\xb1\x 81\xe0\xb0\x97\xe0\xb1\x81</option><option
value="ml_IN">\xe0\xb4\xae\xe
0\xb4\xb2\xe0\xb4\xaf\xe0\xb4\xbe\xe0\xb4\xb3\xe0\xb4\x82</option></select><br
/><input type="submit" class="button" name="save_locale" value="Change
Languag
e" /></form></div><small>Help
Facebook
© 2010 \xe2\x80\xa2 <a href="http://touch.facebook.com/">Touch
Site</a></small></div></
body></html>

Any body had experience to make a reverse proxy for facebook, please
give me a hint!

Thanks a lot!

Fulan Peng

------------------------------------------------------------ ---------
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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
fulan Peng [ Sa, 06 Februar 2010 18:09 ] [ ID #2031511 ]

Re: How to set up a reverse proxy for

On 07.02.10 01:09, fulan Peng wrote:
> I am trying to set up a reverse proxy for facebook by using Apache
> mod_proxy and mod_proxy_html.

reverse proxy for facebook? Are you running facebook servers so you can run
reverse proxy for it?

> Before, it always complain missing a file called ua_callback.php
> I wget it from http://m.facebook.com. It looks like a html file
> instead of a php file.

Of course, the PHP is (usually) parsed on server and (usually) generates
different content than PHP.

> Any body had experience to make a reverse proxy for facebook, please
> give me a hint!

What is the point for running special proxcy for facebook?

--
Matus UHLAR - fantomas, uhlar [at] fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Chernobyl was an Windows 95 beta test site.

------------------------------------------------------------ ---------
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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Matus UHLAR - fantoma [ So, 07 Februar 2010 14:54 ] [ ID #2031551 ]

Re: How to set up a reverse proxy for

On Sun, Feb 7, 2010 at 9:54 PM, Matus UHLAR - fantomas
<uhlar [at] fantomas.sk> wrote:
> On 07.02.10 01:09, fulan Peng wrote:
>> I am trying to set up a reverse proxy for facebook by using Apache
>> mod_proxy and mod_proxy_html.
>
> reverse proxy for facebook? Are you running facebook servers so you can r=
un
> reverse proxy for it?

I am not running facebook server. I just set up a reverse proxy server for =
it.

>
>> Before, it always complain missing a file called ua_callback.php
>> I wget it from http://m.facebook.com. It looks like a html file
>> instead of a php file.
>
> Of course, the PHP is (usually) parsed on server and (usually) generates
> different content than PHP.

I cannot not understand this. I have set up reverse proxy for many web
sites which have php files. The browser ask for the php file, the
proxy should ask for the backend server. The proxy get the results
from the backend server then deliver the results to the browser. Now,
error message on the proxy says the proxy is missing a php file,
something is wrong.

[Sun Feb 07 08:36:58 2010] [error] [client {the browser}] File does
not exist: /usr/local/www/apache22/data/ajax, referer:
https://{myip}:8381/15/login.php?login_attempt=3D1

So I wget http://m.facebook.com/ua_callback.php, I got a
ua_callback.php file which is the results to run the ua_callback.php.

I made a directory, /usr/local/www/apache22/data/ajax and put the
so-called ua_callback.php file in it to trick the browser.

I won't work.

This is my current config with cookie path and domain rewritten.
Still, it won't work.
.....
ProxyPass /13/ http://www.facebook.com/
ProxyPassReverse /13/ http://www.facebook.com/
ProxyPassReverseCookiePath / /13
ProxyPassReverseCookieDomain www.facebook.com <myip>
<Location /13/>
RequestHeader unset Accept-Encoding
ProxyHTMLURLMap http://www.facebook.com
https://${envirnvariableformyip}:8381/13 V
ProxyHTMLURLMap https://login.facebook.com
https://${envirnvariableformyip}:8381/15 V
ProxyHTMLURLMap / /13/
</Location>
ProxyPass /15/ https://login.facebook.com/
ProxyPassReverse /15/ https://login.facebook.com/
ProxyPassReverseCookiePath / /15
ProxyPassReverseCookieDomain login.facebook.com <myip>
<Location /15/>
.....
>
>> Any body had experience to make a reverse proxy for facebook, please
>> give me a hint!
>
> What is the point for running special proxcy for facebook?

Reverse proxy for facebook can help those people behind a firewall to
access facebook. There are many reverse proxy already made for
facebook. I dont know how they are made.
facebook.com worth 5 billion dollars. If you can make a proxy for it,
sure it is useful.

>
>
> Matus - fantomas, uhlar [at] fantomas.sk ; http://www.fantomas.sk/
> Warning: I wish NOT to receive e-mail advertising to this address.
> Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
> Chernobyl was an Windows 95 beta test site.
>
> ------------------------------------------------------------ ---------
> 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 [at] httpd.apache.org
> =A0 " =A0 from the digest: users-digest-unsubscribe [at] httpd.apache.org
> For additional commands, e-mail: users-help [at] 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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
fulan Peng [ So, 07 Februar 2010 15:39 ] [ ID #2031552 ]

Re: How to set up a reverse proxy for

> > On 07.02.10 01:09, fulan Peng wrote:
> >> I am trying to set up a reverse proxy for facebook by using Apache
> >> mod_proxy and mod_proxy_html.

> On Sun, Feb 7, 2010 at 9:54 PM, Matus UHLAR - fantomas
> <uhlar [at] fantomas.sk> wrote:
> > reverse proxy for facebook? Are you running facebook servers so you can run
> > reverse proxy for it?

On 07.02.10 22:39, fulan Peng wrote:
> I am not running facebook server. I just set up a reverse proxy server for
> it.

the term "reverse proxy" is usually used by people who run proxies in froont
of their own webservers, which is not your case. I recommend you to avois
term "reverse" when talking about oproxy for facebook.

> >> Before, it always complain missing a file called ua_callback.php
> >> I wget it from http://m.facebook.com. It looks like a html file
> >> instead of a php file.
> >
> > Of course, the PHP is (usually) parsed on server and (usually) generates
> > different content than PHP.
>
> I cannot not understand this. I have set up reverse proxy for many web
> sites which have php files. The browser ask for the php file, the
> proxy should ask for the backend server. The proxy get the results
> from the backend server then deliver the results to the browser. Now,
> error message on the proxy says the proxy is missing a php file,
> something is wrong.

When the client asks for "php" file, the webserver usually processes the PHP
file and sends its output (not the php file itself) to the client.
Don't wander that you don't see the PHP content in it.

> [Sun Feb 07 08:36:58 2010] [error] [client {the browser}] File does
> not exist: /usr/local/www/apache22/data/ajax, referer:
> https://{myip}:8381/15/login.php?login_attempt=1
>
> So I wget http://m.facebook.com/ua_callback.php, I got a
> ua_callback.php file which is the results to run the ua_callback.php.

better do not do that. I don't know how big part of facebook is cacheable,
but by caching something you should not cache you may break users' privacy
and the application itself.

I think you have been told in squid-users mailing list about this, so let's
better close this issue.
--
Matus UHLAR - fantomas, uhlar [at] fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
"They say when you play that M$ CD backward you can hear satanic messages."
"That's nothing. If you play it forward it will install Windows."

------------------------------------------------------------ ---------
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 [at] httpd.apache.org
" from the digest: users-digest-unsubscribe [at] httpd.apache.org
For additional commands, e-mail: users-help [at] httpd.apache.org
Matus UHLAR - fantoma [ Di, 16 Februar 2010 15:23 ] [ ID #2032481 ]
Webserver » gmane.comp.apache.user » How to set up a reverse proxy for login.facebook.com

Vorheriges Thema: Passing SSL client certificates via mod_proxy_ajp to Tomcat ...
Nächstes Thema: redirecting index.jsp to its folder