Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is the scenario:

I have got a linux server accesible only by one url (because the server is a virtual machine in a vpn):

url: http://foo.bar.com

I have got several web apps accessible in this way:

foo.bar.com/java_app => java wep app installed in a tomcat

foo.bar.com/webpage => webpage installed in apache server

  • Linux server has got an apache2 server which allow me to use several configuration files to create virtual hosts to do the previous issue:

Note: myhost => localhost

ProxyPreserverHost On

<VirtualHost *:80>
   ServerName foo.bar.com
   DocumentRoot /var/www/webpage
   JkMountCopy On
   SSLProxyEngine On

   ProxyPass /java_app http://myhost:8080/java_app
   ProxyPassReseverse /java_app http://myhost:8080/java_app

   #This uses the DocumentRoot
   ProxyPass /webpage http://myhost:80/
   ProxyPassReseverse /webpage http://myhost:80/

</VirtualHost>

The problem is that I have got another software in node.js accessible internally trough this url:

   https://myhost:8061. (a webpage too).

The solution could be adding theses lines:

   ProxyPass /ssl_app https://myhost:8061/
   ProxyPassReseverse /ssl_app https://myhost:8061/

But this fails. The problem is that the files (sources) of the webpage (js, css, other files) are not load properly, accordingly the web app too. (Firefox)

For example inside the "foo.bar.com/ssl_app" I can see the urls of the sources and those must be in this way:

foo.bar.com/ssl_app/js/one.js foo.bar.com/ssl_app/js/two.js foo.bar.com/ssl_app/css/css.js

However I obtain this way:

foo.bar.com/js/one.js foo.bar.com/js/two.js foo.bar.com/css/css.js

(redirection of foo.bar.com/ssl_app => foo.bar.com/)

Obviously the web app does not work.

Thus, if i put foo.bar.com/css/css.js directly, the file is showed properly.

log details:

*** File does not exist: /var/www/webpage/lib, refere http://foo.bar.com/ssl_app 

I think that this is for DocumentRoot (/var/www/webpage/), but how can i create a new VirtualHost with the same ServerName?

Any could say me what can I look in the apache config?

Thank you.

share|improve this question

3 Answers 3

You seem to asume that ProxyPassReverse also modifies URLs in the content delivered by the backend. This is not correct. ProxyPassReverse will only be used when your backend server (your "ssl_app") sends a redirect. Content itself is not touched.

You have several options:

  • Modify your "ssl_app" so it uses the correct base URL for it's resources. This is the best solution.
  • Use mod_proxy_html to modify the html served by the backend before you forward it to the client.
share|improve this answer

You may need to enable

SSLProxyEngine On

To proxy the SSL through the HTTP request.

See: Apache ProxyPass with SSL

share|improve this answer
    
Thank you, but i already active that option (mistake in the main post) –  dlopezgonzalez May 15 '13 at 8:24

The issue is that my "ssl_app" is a web application that uses websockets. Apache does not give support to web sockets so I need to search a way to "redirect" an app with WebSockets (with https://github.com/kawasima/mod_proxy_websocket) or change the http server with Nginx (Nginx is compatible with WebSockets).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.