zope behind apache reverse proxy css and images broken using eduCommons
Hi, I am running a website in a format http://ocw.mydomain.com where only http://mydomain.com has public IP. It is running on Apache. Now I configured a reverse proxy to be able to reach the server where ocw.openitup.in is hosted on Zope what is happening is request which is coming to a domain ocw.mydomain.com first reaches the server mydomain.com (which has a public IP). Then is being forwarded internally to where ocw is present like this URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons i.e. Apache at mydomain.com contains ProxyPass URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons ProxyPassReverse URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons where URL_A is internal IP of machine where the site is hosted for a request to be able to reach Zope Zope documentation page says it should have VirtualHostBase and VirtualHostRoot as its path elements. Which in above format I have done. But if some one opens the domain http://ocw.mydomain.com then the CSS which is getting loaded in browser when I click view source it shows a href="URL_B/eduCommons/path/to/CSS" URL_B is internal IP of server where eduCommons is running. Note that in a users browser on internet it does not show URL_A that means that request coming from internet has been able to reach what ever URL_A means in above directives. I have checked it by replacing with hostname of server on which it is running. The CSS does not loads. If I use hostname instead of URL_B then http://ocw.mydomain.com tries to load CSS, Javascrips and images from href="http://Hostname_B/eduCommons/path/to/CSS" now Hostname_B is also known only to then computers which are in my LAN. Any request on internet does know any thing about it. I checked replacing Hostname_B with ocw.mydomain.com even then the broken element in page source shows it is trying to fetch the CSS,Javascript or images from href="ocw.mydomain.com/eduCommons" the above URL is in page source when client browser tries to load CSS,Javascript or image on internet. So what is happening is in the reverse proxy server which is the first place where the request are coming it is forwarded internally as URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons what ever is present in place of URL_B that the client browser on internet is trying to load which obviously is not present. I have also checked by replacing URL_B with URL_A i.e. ProxyPass URL_A/VirtualHostBase/http/URL_A/VirtualHostRoot/eduCommons ProxyPassReverse URL_A/VirtualHostBase/http/URL_A/VirtualHostRoot/eduCommons then on a client browser on internet the CSS is being loaded from URL_A/eduCommons/path/to/CSS where URL A is again only known to my LAN and in above ProxyPass Directive it is taken from second occurrence of URL_A This URL_A string which some one is getting in a client browser on internet is again internal IP of my machine where I hosted EduCommons. -- Tapas
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tapas Mishra wrote:
Hi, I am running a website in a format http://ocw.mydomain.com where only http://mydomain.com has public IP. It is running on Apache.
Now I configured a reverse proxy to be able to reach the server where ocw.openitup.in is hosted on Zope what is happening is request which is coming to a domain ocw.mydomain.com
first reaches the server mydomain.com (which has a public IP).
Then is being forwarded internally to where ocw is present like this
URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons
i.e. Apache at mydomain.com contains
ProxyPass URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons ProxyPassReverse URL_A/VirtualHostBase/http/URL_B/VirtualHostRoot/eduCommons
The "best practice"[1] is to use mod_rewrite in conjunction with mod_proxy, e.g.: RewriteEngine On RewriteRule ^/(.*) \ URLA/VirtualHostBase/http/%{HTTP_HOST}:80/rootfolder/VirtualHostRoot/$1\ [L,P] where the backslashes indicates that the pattern should be on the same line. The "rewrite witch" can help with getting the rule syntax correct: http://betabug.ch/zope/witch [1] http://wiki.zope.org/zope2/ZopeAndApache Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkwPgZkACgkQ+gerLs4ltQ7z2ACdF5tXnQ05peQKoWrRaBASaXFc 2xMAoL3iBdZr+ZD91ZNJbz15D2z0pfs+ =CsFt -----END PGP SIGNATURE-----
On Wed, Jun 9, 2010 at 5:27 PM, Tres Seaver <tseaver@palladion.com> wrote:
The "best practice"[1] is to use mod_rewrite in conjunction with mod_proxy, e.g.: Thanks for clearing that out.
RewriteEngine On RewriteRule ^/(.*) \ URLA/VirtualHostBase/http/%{HTTP_HOST}:80/rootfolder/VirtualHostRoot/$1\ [L,P] Just one confusion about the syntax here HTTP_HOST will be replaced by internal IP or hostname where Zope is serving the pages so should I use %{ } or replaces it by the hostname
http://betabug.ch/zope/witch A lot of thanks for this link.
-- Tapas
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tapas Mishra wrote:
On Wed, Jun 9, 2010 at 5:27 PM, Tres Seaver <tseaver@palladion.com> wrote:
The "best practice"[1] is to use mod_rewrite in conjunction with mod_proxy, e.g.: Thanks for clearing that out.
RewriteEngine On RewriteRule ^/(.*) \ URLA/VirtualHostBase/http/%{HTTP_HOST}:80/rootfolder/VirtualHostRoot/$1\ [L,P] Just one confusion about the syntax here HTTP_HOST will be replaced by internal IP or hostname where Zope is serving the pages so should I use %{ } or replaces it by the hostname
It will be the hostname that the browser requiested (the "Host:" header).
http://betabug.ch/zope/witch A lot of thanks for this link.
You're welcome! Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkwPqTMACgkQ+gerLs4ltQ6wgACePdqWEAjW2MwrI+w9QGqd2WbT ykYAn3yRgeRZe0jstlkiuuj6rzTOLgJG =rJ1U -----END PGP SIGNATURE-----
On Wed, Jun 9, 2010 at 8:16 PM, Tres Seaver <tseaver@palladion.com> wrote:
It will be the hostname that the browser requiested (the "Host:" header). Thanks a lot for telling this.If possible give me a link about this statement.My site is actually working. What I finally did was URLA/VirtualHostBase/http/%{HTTP_HOST}:80/rootfolder/VirtualHostRoot/$1\ [L,P] replaced URLA with the hostname of server which the site is requesting and HTTP_HOST by the URL which browser requests. -- Tapas
participants (2)
-
Tapas Mishra -
Tres Seaver