hello,
I posted this in Glassfish forum as well, but would see what you guys
think.
I am having trouble with routes and apache mod_proxy_balancer with
Glassfish and Jruby rails application. Can anyone share how this is
properly supposed to be setup ?
but to no avail. Also i dont want /myapp/ to show up in the URL path
when a
user is browsing, it seems glassfish was redirecting to
/myapp/session/new
back to apache which was causing issues as well.
I’ve been using create-virtual-server + create-http-listener (with the
default virtual server I just created) to create a virtual server to
deploy to. When I deploy I deploy to the virtual server with
contextroot of /.
Then I only have to proxy to a given port, and not worry about paths.
Hi AD,
You can deploy multiple instances of the same app, however if
you require them to be deployed as context-roots (/), then you
need to follow Todd’s suggestion.
There is no extra configuration necessary if deployed as app1,app2, etc.
All on the same IP / Port ? Or do these require different ports ?
Just trying to make sure I understand the root cause of why this can not
be
done with normal mod_proxy_balancer setup…
Hi Adam,
Another option you have, is that if you are not completely tied to
Glassfish, you can use Tomcat, which has a more comprehensive
Virtual Hosting support for what you are looking for.
Just so i am COMPLETELY clear
It is not possible through apache_mod_proxy to deploy 1 application like
ProxyPass / ajp://localhost:8009/myapp/
without the /myapp/ anywhere in the website. The only way to do this is
to
deploy the war to a context root of “/”, which would require a new
virtualhost for each war Rails app ?
In each Tomcat node, place the following in the server.xml file:
The snippet should be placed towards the bottom of the server.xml file
just above
In the Apache mod_proxy config place the following or similar:
ProxyPass / balancer://clouda_1_0/ stickysession=JSESSIONID
<Proxy balancer://clouda_1_0>
BalancerMember ajp://srv2.cloud:8116 route=qcbxxrda-s7000-srv2_1
loadfactor=50
BalancerMember ajp://srv1.cloud:8116 route=qcf7xjo5-pointer-srv1_1
loadfactor=50
You may also want to check the Tomcat list.
Hope this helps you get started.
AD wrote:
Thanks again
Virtual Hosting support for what you are looking for.
All on the same IP / Port ? Or do these require different
glassfish app server.
deploy to. When I deploy I deploy to the
<mailto:[email protected]>> wrote:
Can anyone share how this is
#ActionController::AbstractRequest.relative_url_root
well.
recipient(s). Unauthorized use is prohibited.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Just so i am COMPLETELY clear
It is not possible through apache_mod_proxy to deploy 1 application like
ProxyPass / ajp://localhost:8009/myapp/
Well, it’s probably possible, but problematic, as per your first post.
without the /myapp/ anywhere in the website. The only way to do this is to
deploy the war to a context root of “/”, which would require a new
virtualhost for each war Rails app ?
That is the method I use, and would be a solution to the route
problem. Out of curiosity, what happens if you navigate directly to http://localhost:8009/myapp/ in your browser, without proxying through
apache? That should let you know if you need to tune mod_proxy, or
the appserver/rails app.
done with normal mod_proxy_balancer setup…
default virtual server I just created) to create a virtual server to
hello,
But i get an error in glassfish server.log "No route matches
Any help here appreciated.
To unsubscribe from this list, please visit:
recipient(s). Unauthorized use is prohibited.
the Drag-and-drop Hosting CLOUD
–
CONFIDENTIALITY NOTICE: This email is for sole use of intended
recipient(s). Unauthorized use is prohibited.
things work fine at http://localhost:8009/myapp/. All the paths in the
app
are prefixed with /myapp/ though, my guess is this is something that
Warbler
and Rack do .
well the initial request to rails seems fine for the root action, rails
does
not see a double /myapp/, but as you said the links are prefixed with
the
context root, and all 302 redirects have the relative_url_root sent back
to
apache which is breaking this.
THanks for the tip here, will give it a try.
Correct, and therein lies your problem: All links are getting rendered
with /myapp in them, so that when you proxy those requests, they’re
going back to the app as /myapp/myapp/… and Rails is seeing the
extra /myapp prefix.
Seems like the only way to fix this is to turn off JRuby-Rack’s
automatic setting of relative_url_root. To do this, you’ll need the
following monkeypatch (offending code commented):
class JRuby::Rack::RailsSetup
def call(env)
env['rails.session_options'] =
@servlet_helper.session_options_for_request(env)
env[‘HTTPS’] = ‘on’ if env[‘rack.url_scheme’] == ‘https’
# relative_url_root = env[‘java.servlet_request’].getContextPath
# if relative_url_root && !relative_url_root.empty?
# env[‘RAILS_RELATIVE_URL_ROOT’] = relative_url_root
# ActionController::Base.relative_url_root =
relative_url_root if
ActionController::Base.respond_to?(:relative_url_root=)
# end @app.call(env)
end
end
Put that in environment.rb or in config/initializers so that it gets
loaded once at Rails startup.