intercity / intercity-next

Web control panel to deploy apps on your servers (with Dokku)
https://intercity.io/
MIT License
116 stars 23 forks source link

Error 404 for assets #266

Open Filipe-Souza opened 5 years ago

Filipe-Souza commented 5 years ago

Hello,

I made a fresh install of intercity using this script: bootstrap.sh. But when accessing the configured domain, the assets from the page shows 404 errors.

Examples (in browser):

GET https://customdomain.com/assets/application-33a32c73fee422e91b607ed06692d9971c7a537b25f6b7b597d12d45dce5c9c6.css net::ERR_ABORTED 404 GET https://customdomain.com/assets/application-edc1f8e2f6dd27abb52f87d60ab38c4ccae245ba793a13ff762c49a19f758083.js 404 GET https://customdomain.com/assets/logo_icon-5d7d7bf45efebb87117d08fb6b42f04a136f618aaf9ebf4a608841e8b425542a.svg 404

Acessing the logs in docker shows me the following errors (server):

app_1          | 14:03:14 web.1     |  INFO -- : [50e68845-1a87-412f-a4e0-d2b53b81caec] Started GET "/assets/application-33a32c73fee422e91b607ed06692d9971c7a537b25f6b7b597d12d45dce5c9c6.css" for 191.255.93.96 at 2019-05-09 14:03:14 +0000

app_1          | 14:03:14 web.1     | F, [2019-05-09T14:03:14.585418 #17] FATAL -- : [50e68845-1a87-412f-a4e0-d2b53b81caec]   

app_1          | 14:03:14 web.1     | F, [2019-05-09T14:03:14.585453 #17] FATAL -- : [50e68845-1a87-412f-a4e0-d2b53b81caec] ActionController::RoutingError (No route matches [GET] "/assets/application-33a32c73fee422e91b607ed06692d9971c7a537b25f6b7b597d12d45dce5c9c6.css"):

Another example:

app_1          | 14:03:14 web.1     | I, [2019-05-09T14:03:14.586130 #17]  INFO -- : [0402d8f5-f4e7-476e-9b98-2fc9d2ddf080] Started GET "/assets/application-edc1f8e2f6dd27abb52f87d60ab38c4ccae245ba793a13ff762c49a19f758083.js" for 191.255.93.96 at 2019-05-09 14:03:14 +0000
app_1          | 14:03:14 web.1     | F, [2019-05-09T14:03:14.586534 #17] FATAL -- : [0402d8f5-f4e7-476e-9b98-2fc9d2ddf080]   
app_1          | 14:03:14 web.1     | F, [2019-05-09T14:03:14.586566 #17] FATAL -- : [0402d8f5-f4e7-476e-9b98-2fc9d2ddf080] ActionController::RoutingError (No route matches [GET] "/assets/application-edc1f8e2f6dd27abb52f87d60ab38c4ccae245ba793a13ff762c49a19f758083.js"):

Maybe I'm missing something in the initial setup. This errors occur in all pages.

voidberg commented 5 years ago

Same issue happened to me as well.

Also, the add server page did not work, submitting it resulted into what looked like a 404 page.

sptutusukanta commented 5 years ago

Same problem here.

I've also tried to add the env variable RAILS_SERVE_STATIC_ASSETS=true by entering into the container. But nothing is working.

Please help!

wkoehn commented 5 years ago

I'm also getting 404 errors for css files.

tux-tn commented 5 years ago

Hello, I got the same issue today. Looks like static assets requests are proxied to the Ruby container and not loaded by nginx. I temporary fixed the issue by adding the correct config inside the nginx-proxy container. This the missing config:

location ~ "^/assets/.+-[0-9a-f]{32}.*" {
  root        /app/public;
  gzip_static on;
  expires     max;
  add_header  Cache-Control public;
}

If you put it inside the second server directive in /etc/nginx/conf.d/default.conf and reload the nginx process nginx -s reload the static assets will load correctly. I will try to investigate why this config is missing and add a PR EDIT: An easier solution that persists after container reboot is to create a file inside the docker vhost volume directory. The file need to have the same name as your instance FQDN and contain the same config pasted above