We have a tomcat application which works fine in IE7/8 and Firefox. The only browser we are having issues with (that we care about at this point) is google Chrome. Users can navigate to the application fine and log in and do whatever they need to do in Firefox and IE. However, when trying to log in with Chrome, the session is apparently lost immediately after log in and when the authenticated user tries to navigate to another page they are bumped back to the log in page. This happens consistently.
I have seen other entries here and elsewhere that suggest that the context path might be to blame. I have tried setting a ProxyReverseCookiePath but that does not fix the problem.
Our virtual host configuration is as follows:
<VirtualHost xxx.xxx.xxx.xxx:80>
ServerAdmin admin#email.com
ServerName subdomain.example.com
DocumentRoot /var/www
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /context/ ajp://127.0.0.1:8009/context/
ProxyPass / ajp://127.0.0.1:8009/context/
#ProxyPassReverse /context/ http://127.0.0.1:8009/context/
#ProxyPassReverse / http://127.0.0.1:8009/context/
#ProxyPassReverseCookiePath /context/ /
</VirtualHost>
There is another application deployed on the same instance of tomcat at the ROOT context. I have looked at the JSESSIONID that is set in the cookie, which is sent back to Chrome and it changes on every request, while it does not for IE and Firefox.
I am at a loss here. Any ideas are welcome!
We are using tomcat 6.0.23 as well as apache 2.2.14
For reference: The problem was solved by deploying the application at root context path and removing the context paths from the proxy statements.
ProxyPass /context/ ajp://127.0.0.1:8009/
ProxyPass / ajp://127.0.0.1:8009/
Nothing else was needed.
Related
I have a app named "FitnessTracker" running on tomcat, post 8080. I am using Spring Security, and everything works fine when I test it directly on tomcat using http://localhost:8080/FitnessTracker
I then configured mod_proxy_ajp on Apache http 2.2, to access using a domain name, below is my VirtualHost configuration:
<VirtualHost *:80>
ServerName www.testing.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
RewriteEngine on
RewriteRule ^/FitnessTracker/(.*)$ /$1 [P]
ProxyPass / ajp://localhost:8009/FitnessTracker/
ProxyPassReverse / ajp://localhost:8009/FitnessTracker/
</VirtualHost>
Now, when I access www.testing.com/ - it gets redirected to www.testing.com/FitnessTracker/login.html
Is there a way to not have /FitnessTracker/ in the URL? I would like to hide the tomcat Context name from the URL.
Ideally, I want the URL to look like www.testing.com/login.html
I know that this is due to the RewriteRule, but without the rewrite rule spring security with mod_proxy doesn't work - since Spring security redirects to login page along with context name.
Please let me know if you have suggestions.
I think you forgot to rewrite the cookie domain and cookie path. Check ProxyPassReverseCookieDomain directive. From the backend perspective the request path still has to look like /FitnessTracker/
I am trying to run Shell In a Box (link) through another server (the computer running shellinabox is not accessible from the internet) . Ideally I could use ProxyPass in the Apache config to have a reverse proxy. Problem is I can't access the conf file. So I tried using .htaccess and I discover that I cannot use ProxyPass in there. So I tried and used mod_rewrite to do the job. Currently I have the following on the .htaccess file
RewriteEngine On
RewriteRule ^$ http://10.1.13.236:4200/ [P]
However while it displays the title correctly and if I open up the source code I can see there is something in the page, nothing is diplayed on the screen (it remains blank). My suspicion is that there are problems with AJAX and this kind of proxy.
What I am trying to accomplish with the mod_rewrite as close as possible behaviour to ProxyPass (Mirorr a website in a subdirectory).
Is this possible? Is there some other solution (I tried phproxy and khproxy but neither of them is able to display anything)?
I'm trying to setup a simple proxy in Apache for RESTful services that I have on a different server. For example, if I go to https://myclient.com/services/hello it will show me the JSON for the URL https://myserver.com/services/hello.
I'm doing this to get cross-domain ajax working. I've found a lot of information about how to set this up, but none of the suggestions I have found work. I thought this should be fairly straightforward, so it's probably an easy answer for someone.
My current settings are forwarding me to the RESTful URL instead of just showing the content. I'm using a basic Apache setup without virtual hosts and configuring everything in my httpd.conf. I am using SSL and also am using a proxy to Tomcat on the same Apache server:
SSLProxyEngine On
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
ProxyPass /services/ https://myserver.com/services/
ProxyPassReverse /services/ https://myserver.com/services/
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
I've tried a combination of a lot of other settings as well, including an addition RewriteRule, but this simple configuration is the closest I've gotten.
The problems were due to a SSO server that I had setup - requests were being redirected through this server, and this caused a redirect from the SSO server to the API server. The apache settings were correct.
people i have to create a second site in the same webserver that i already have my first site. i,m not sure on how i can do this, i would not like to have to change all the url that i have already created. i was thinking on installing a second joomla inside the folder where is the first one. the url will be www.myweb1.com/joomla2, that is something that i would not like is there a way by my dns that i can change that www.myweb1.com/joomla2, to www.joomla2.com
I just want to create a new joomla site in the same webserver that i already have one joomla site. I,m using apache2 with opensuse. the first site already have a vhost to manage https rewrite conditions.
Any recomendation.
You can use the proxy functionality of Apache HTTPD.
Such configuration might look like:
<VirtualHost *>
ServerName www.joomla2.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.myweb1.com/joomla2
ProxyPassReverse / http://www.myweb1.com/joomla2
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
I have a plone zinstance set up through Apache Proxy on OS X Server 10.5. The server is set up with a single vhost on port 80, with Proxy & Proxypass directives to the Plone zinstance:
ProxyPass / http://localhost:8080/VirtualHostBase/http/server:80/Plone/VirtualHostRoot/
ProxyPassReverse / http://localhost:8080/VirtualHostBase/http/server:80/Plone/VirtualHostRoot/
However, I have some static HTML and PHP content that I want to display in an iframe via the plone site. I'm thinking I'll need to set up another vhost on a different port, then just specify the port # inline?
Set up a static URL that will not be proxied but served from Apache directly, like this:
ProxyPass /static !
ProxyPass / http://localhost:8080/VirtualHostBase/http/server:80/Plone/VirtualHostRoot/
ProxyPassReverse / http://localhost:8080/VirtualHostBase/http/server:80/Plone/VirtualHostRoot/
Then configure /static to contain your static content.
I'd recommend rolling your configuration into a virtual host block. You can deliver static content directly form apache by rewriting a specific path. Here's an example
<VirtualHost *:80>
ServerName yoursite.com
Alias /static /var/www/some/path/
<Directory "/var/www/some/path">
Options Includes FollowSymLinks
AllowOverride All
</Directory>
# Zope rewrite.
RewriteEngine On
RewriteRule /static - [L]
RewriteRule ^/(.*) http://127.0.0.1:8080/VirtualHostBase/http/%{SERVER_NAME}:80/Plone/VirtualHostRoot/$1 [L,P]
</VirtualHost>
Sorry, not enough information but I'll offer a couple of comments that might help point you in the right direction.
First, ProxyPassReverse is unnecessary as Plone already takes care of fixing up any self-referential urls. That is the point of the crazy url after all.
Another poster already showed how to configure ProxyPass to selectively bypass the proxy to Plone and serve from Apache directly.
Regarding the "additional vhost on port 8888". It's not clear what you mean by this. What is the extra vhost serving? If it's where your static html and php content is supposed to come from then restricting to localhost only means you're going to have to also configure an internal proxy to reach it. You can do that with Rewrite rules but that seems like an overly-complicated way to go in this usecase. Why is this vhost available to localhost only? For that matter, why are using a separate vhost... you can do this all (Plone, static files, and PHP) in just one vhost with the appropriate ProxyPass lines (or Rewrite lines if you need more flexibility).