Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 404 for assets #266

Open
Filipe-Souza opened this issue May 9, 2019 · 4 comments
Open

Error 404 for assets #266

Filipe-Souza opened this issue May 9, 2019 · 4 comments

Comments

@Filipe-Souza
Copy link

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
Copy link

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
Copy link

sptutusukanta commented May 22, 2019

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
Copy link

wkoehn commented May 22, 2019

I'm also getting 404 errors for css files.

@tux-tn
Copy link

tux-tn commented May 26, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants