You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today when we deployed the redesign, we first saw the new page without any styles at all. After some digging around, we found out that the asset files (css, javascript, images etc.) were properly compiled, into the directory public/assets, as is usual for rails apps in production. However, when the browser requested any of those asset files, it got a 404 not found. Why?
Usually, rails apps in production are run together with a webserver such as nginx or Apache, and those webservers are configured to serve static files from public by themselves. The Rails app can serve these files itself as well, but this is only meant as an inefficient fallback, and needs to be explicitly switched on with a configuration option. It is on by default in development mode, but off in production.
Our Apache server on Uberspace seems not to be configured to serve files from public, so we had to switch on that option, here is the change:
I don't understand at all why it has been working before the redesign. Baffled.
In its Rails docs, Uberspace recommends to let Rails serve the assets, saying this way is easier to set up: https://wiki.uberspace.de/cool:rails . But I think it would still be a lot better (faster pages!) to have Apache do it. Hence this issue - someone please research the Apache config change that is necessary to serve static files from the rorganize.it/public/, while still forwarding other requests to our app. The config change should then probably go in the .htaccess file on the server. Here is its current content:
That stackoverflow post is about serving it from a _different_ directory
than /public/, so it doesn't fully apply. We would be happy if we can
set up the standard Rails way to work, that is, all requests to static
files (e.g. precompiled assets) are served by Apache directly. The files
are located in the filesystem in the /public/ folder. But the browser
never sees the "public" part in the URL, it's just a configuration that
tells Apache where to find them.
An example request URL would be
"https://rorganize.it/assets/javascripts/application-124131.js"
and the corresponding static file on the server would be in
~/rorganize.it/public/assets/application-124131.js
Today when we deployed the redesign, we first saw the new page without any styles at all. After some digging around, we found out that the asset files (css, javascript, images etc.) were properly compiled, into the directory
public/assets
, as is usual for rails apps in production. However, when the browser requested any of those asset files, it got a 404 not found. Why?Usually, rails apps in production are run together with a webserver such as nginx or Apache, and those webservers are configured to serve static files from
public
by themselves. The Rails app can serve these files itself as well, but this is only meant as an inefficient fallback, and needs to be explicitly switched on with a configuration option. It is on by default in development mode, but off in production.Our Apache server on Uberspace seems not to be configured to serve files from
public
, so we had to switch on that option, here is the change:089d7dc
I don't understand at all why it has been working before the redesign. Baffled.
In its Rails docs, Uberspace recommends to let Rails serve the assets, saying this way is easier to set up: https://wiki.uberspace.de/cool:rails . But I think it would still be a lot better (faster pages!) to have Apache do it. Hence this issue - someone please research the Apache config change that is necessary to serve static files from the
rorganize.it/public/
, while still forwarding other requests to our app. The config change should then probably go in the.htaccess
file on the server. Here is its current content:The text was updated successfully, but these errors were encountered: