Error on deploying in sub-URI

15 views
Skip to first unread message

Txinto Vaz

unread,
Aug 23, 2016, 6:57:11 AM8/23/16
to Hobo Users
Hello!

I've some web apps working with Hobo.  My apache configuration loads all of them in different sub-URIs.  One of them (the newest) has a problem and misses the sub-URI part of the route when creating the links, so "Not found" appears after the first link the user clicks.

These are the different apps I am deploying:

  • A: Based on gem 'hobo', '= 2.2.6' --> FAILS
  • B: Based on gem 'hobo', '= 2.2.4' --> WORKS.
  • C: Based gem "hobo", "= 1.0.3" --> WORKS.
The symptom is: if I open my A app using the path http://myserver/a, it perfectly opens.  Then I click on Home and works fine, but then I click on "Login" and it builds the wrong path http://myserver/login instead of http://myserver/a/login

I've tested the correct configuration of Apache by exchanging the paths of A and B.  B app was correctly working on A directory, but A app also fails on B directory.

I've also checked that config/routes.rb and config/environments/production.rb have similar contents.

Any idea of the problem or can you help me to find the code that could have impact on this?

Thanks in advance.

Tx. 

PD: If needed, I am using ruby ruby 2.1.5p273 (2014-11-13) [x86_64-linux-gnu] on Debian.
The A app (the faulty one) is https://github.com/gatATAC/eo, the B one (working one) is https://github.com/gatATAC/uCANca, and the C (the old and working one) is https://github.com/gatATAC/poris/tree/master/Editors/Web/PorisWebEditor

Txinto Vaz

unread,
Aug 23, 2016, 7:54:57 AM8/23/16
to Hobo Users
Just more info: I am deploying using Apache and Passenger.  The app works fine with a port or subdomain, but for this deployment I can not use subdomains.

Best regards.

Tx.

txinto

unread,
Aug 25, 2016, 7:13:21 AM8/25/16
to Hobo Users
Hello, I think it can be a bug of Hobo.  I've created a new hobo 2.2.6 app from scratch, and has the same behaviour.  It is not possible to deploy it in an apache directory.

I've uploaded my vanilla code here:


Best regards.

Tx.

Tim Griffin

unread,
Aug 25, 2016, 4:14:25 PM8/25/16
to Hobo Users
Hi Txinto;

Here are a few odds and sods that might point in the right direction.

If you're using Passenger, you might have to do this in the virtual host configuration file for Apache:

  PassengerRuby /opt/rubies/ruby-1.9.3-p551/bin/ruby

 

  PassengerFriendlyErrorPages on

 

  RailsEnv staging

 

  # RAILS_RELATIVE_URL_ROOT is critical to getting Rails and Hobo to generate the proper

  # URLs for links as well as internal routing for Hobo's Controller

  # and seems to be required along with the internal configuration

  # of

  #   config.action_controller.relative_url_root = '/app/lts-test'

  # and

  #   config.assets.prefix = "/app/lts-test"

  # within production.rb

 

  # http://guides.rubyonrails.org/configuring.html#deploy-to-a-subdirectory-relative-url-root

  SetEnv RAILS_RELATIVE_URL_ROOT "/app/lts-test"



For this example, I have an app named "lts"  hosted at at https://www.server.com/app/lts-test with
the path "/app/lts-test" on server.com being proxyied to a port on the application hosting server.  The proxying is also passing the "/app/lts-test" path through to our app so, Rails has to understand that the path "/app/lts-test" actually
represents the app.

So, you might also have to tinker with config.ru in your application and include this:

    map '/app/lts-test' do
      run LTS::Application
    end


Tim

txinto

unread,
Aug 29, 2016, 9:21:36 AM8/29/16
to Hobo Users
Hi Tim, many thanks for your answer.
Unfortunately did not solve my problem.

My supposition is that the bug is beyond this configuration topics.  All the other hobo apps work fine but this refuse to work, even setting the passenger base uri or the rails relative url root and config.ru.

This is my current Apache config:

    Alias /eo /opt/eo/public
    <Location /eo>
        PassengerBaseURI /eo
        PassengerAppRoot /opt/eo/
        RailsEnv production
        # PassengerFriendlyErrorPages on
        # RAILS_RELATIVE_URL_ROOT is critical to getting Rails and Hobo to generate the proper
        # URLs for links as well as internal routing for Hobo's Controller
        # and seems to be required along with the internal configuration
        # of
        #   config.action_controller.relative_url_root = '/eo'
        # and
        #   config.assets.prefix = "/eo"
        # SetEnv RAILS_RELATIVE_URL_ROOT "/eo"
    </Location>
    <Directory /opt/eo/public>
        Allow from all
        Options -MultiViews
        Options FollowSymLinks
        # Uncomment this if you're on Apache >= 2.4:
        Require all granted
    </Directory>

You can see the your configuration proposal currently commented.  None of both works.

What I've not try yet is to downgrade the Ruby to 1.9, or upgrade it to 2.3 to see if it works.

BR.

Tx.

Txinto Vaz

unread,
Aug 31, 2016, 12:24:10 PM8/31/16
to hobo...@googlegroups.com
Hello again.

This change fixed the problem (don't know if it creates another).


Best regards.

Tx.

--
You received this message because you are subscribed to the Google Groups "Hobo Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hobousers+unsubscribe@googlegroups.com.
To post to this group, send email to hobo...@googlegroups.com.
Visit this group at https://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages