I'm currently running a websocket server. I want to be able to access this through ws.mydomain.com
The web socket is listening on port 8080.
I'm running Apache 2.4 and my configuration looks look this.
<VirtualHost *:80>
ServerName ws.mydomain.com
ProxyRequests Off
<Location />
ProxyPass ws://xxx.xxx.x.xx:8080/
</Location>
</VirtualHost>
when I try to connect on websocket.org it won't let me while I'm pretty sure they are doing something similar theirself in their example.
Does anyone know what might be going wrong here?
Related
I had Apache configuration which was using a ProxyPass/ProxyPassReverse with the following example syntax:
ProxyPass /myprog http://localhost:8080/myprog
ProxyPassReverse /myprog http://localhost:8080/myprog
Then, I moved Apache from port 80, to 8880, and put another web server on port 80. I can access some things correctly now on port 8880 - those files which are hosted directly on Apache. But my proxy pass (to Tomcat) now fails when I try to access it at: http://some.domain:8880/myprog.
How do I correct the ProxyPass/Reseverse to account for the port change? (I assumed, perhaps natively, the port spec was implicit...).
You need to put your configuration on a VirtualHost tag.
<VirtualHost *:8880>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /myprog http://localhost:8080/myprog
ProxyPassReverse /myprog http://localhost:8080/myprog
</VirtualHost>
I have devserver on intranet with ubuntu, apache 2.4. There is some service running on direct ports like yourtrack on port 9000.
When I connecting directly its working properly (http://devserver:9000/).
But I want to make on this format. http://devserver/yourtrack
How could I do this?
You could use apache proxying to your application. So you declare the port 80 virtual host and the use proxy pass to proxy to the other port.
<VirtualHost *:80>
ServerName devserver
ProxyPreserveHost On
ProxyPass /yourtrack http://devserver:9000/
ProxyPassReverse /yourtrack http://devserver:9000/
</VirtualHost>
WARNING: This could have adverse effect on the application you're running depending what it does with http requests.
On my system I have more than one web daemon running, one of them is Apache which is listening on ports 80 and 443. Another only accepts local connections on a different port.
Is it possible for Apache to forward connections to another daemon, wait for the reply before sending it back to the original client?
Possible config file could look like:
<VirtualHost *:80>
ServerName another-hostname.com
ForwardConnectionTo localhost:4949
</VirtualHost>
Use a ProxyPass. Make sure you have mod_proxy and mod_proxy_http enabled:
<VirtualHost *:80>
ServerName another-hostname.com
ProxyPerserveHost On
ProxyPass / http://localhost:4949
</VirtualHost>
Is there an easy way to change from domain.com:8080/myapp to domain.com? Any step by step working examples for Tomcat 7?
Yes, you can use Apache Mod_Proxy for this. You use Apache2 as a front-end to your Tomcat instance.
Here is a configuration example:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName site.domain.com
Redirect / /tomcat-context/
ProxyPass /tomcat-context/ http://127.0.0.1:tomcat-port/tomcat-context/
ProxyPassReverse /tomcat-context/ http://site.domain.com/tomcat-context/
ProxyPreserveHost On
</VirtualHost>
You can find more infos here.
It may seem a bit hard to grasp at first if you're not an Apache2 expert (I am not), but once you've configured your first frontend, adding more and more tomcat instances behind it is a breeze.
Or if you're lazy, change the connector port from 8080 to 80 in the conf/server.xml file in your tomcat home directory.
I am trying to setup a server with multiple web applications which will all be served through apache VirtualHost (apache running on the same server). My main constrain is that each web application must use SSL encryption. After googling for a while and looking other questions on stackoverflow, I wrote the following configuration for the VirtualHost:
<VirtualHost 1.2.3.4:443>
ServerName host.domain.org
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/
</VirtualHost>
Even though https://host.domain.org:8443 is accessible, https://host.domain.org is not, which defeats the purpose of my virtual host configuration. Firefox complains that even though it successfully connected to the server, the connection was interrupted. Chrome return an error 107: net::ERR_SSL_PROTOCOL_ERROR.
Finally I should also mention that the virtual host works perfectly fine when I do not use SSL.
How can I make this work ?
Thanks
You don't need to configure SSL in both Apache and Tomcat.
The easiest way to accomplish that is configure SSL just on Apache and proxy to tomcat using http.