Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Passenger deployment in subdir broken #116

Closed
mck9 opened this Issue · 12 comments

3 participants

@mck9

I deploy the crm in a suburl (e.g. /var/www/crm) and state ':base_url: "/crm"' in my settings. When I call the application I am getting an 'Routing Error: No route matches [GET] "/"'. Passenger handles it, so I have to set base_url to "/". Most parts of ffc are now working, but not all. Assets and ajax routes are not found: GET https://server.local/assets/avatar.jpg [HTTP/1.1 404 Not Found 2ms].
Anybody knows how to fix it?

@ndbroadbent
Owner

Hi @mck9, thanks for reporting this issue.

I believe I have fixed the assets and ajax routes to honor the base_url setting, please update from the master branch and try again.

@mck9

Updated from master. Sorry, but that wasn't it. Now with "/" as base_url the application wants to load this URL: https://assets/iconset_attribution-be9d089183efa02735825b86ddb6155c.png
Why do you have this base_url setting anyway?

@ndbroadbent
Owner
@mck9

OK. I can't use "/crm", because of -> Routing Error: No route matches [GET] "/"

@ndbroadbent
Owner

The Routing Error is expected behaviour in that case... The Rails app will not handle any requests for /, because every request URL needs to start with /crm. Apache will be serving assets from /crm/assets,
and the Rails application will handle requests to /crm/contacts, /crm/accounts, /crm/admin, etc...

If you use a base_url of /crm, then you should be visiting http://example.com/crm, and not http://example.com/.

@mck9

I think you misunderstood my issue. I have a setup with Apache and Passenger. The ffcrm app is registered like that:
RailsBaseURI /crm. I do call http://example.com/crm

@ndbroadbent
Owner

Ah I see, sorry about the confusion.

Could you please try the following steps:

  • Set the base_url as "/crm" (required for the asset URLs)
  • Change the following lines in config/routes.rb:
FatFreeCRM.application.routes.draw do
-  scope Setting.base_url do
+  scope "" do

(Get rid of the scope, which I don't think is necessary when you use Passenger's RailsBaseURI)

@mck9

Done that. Some issues are resolved, others remain:

/assets/loading.gif
/contacts/field_group?tag=mytag&asset_id=1&collapsed=no

I think this is due to absolute URLs in CSS and JS files..

@ndbroadbent
Owner

OK, I've just pushed changes that remove the routing scope. Have fixed those two URLs you mentioned, you are right that they were absolute URLs in JS files (so just bugs).
Were those the only remaining issues?

@mck9

Thanks for the update. Works mostly:

GET https://server/assets/asterisk.gif [HTTP/1.1 404 Not Found 2ms]
GET https://server/assets/chosen-sprite-6bf2d1950160ce2fbfb76968fadae3f1.png [HTTP/1.1 404 Not Found 2ms]

should be

https://server/crm/...

@steveyken
Owner

Is this still an issue?

@steveyken
Owner

Will close for now. Ping me if it's a problem

@steveyken steveyken closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.