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

CSS assets fail to load when using catch all or vanity url #245

Closed
kjf opened this issue Dec 29, 2024 · 3 comments · Fixed by #253
Closed

CSS assets fail to load when using catch all or vanity url #245

kjf opened this issue Dec 29, 2024 · 3 comments · Fixed by #253

Comments

@kjf
Copy link

kjf commented Dec 29, 2024

My app has a user route at the end of my routes file to support vanity urls. E.g.

resources :users, only: :show, path: ""

meaning I can resolve: https://myapp.com/excid3

This seems to cause a problem with the madmin css files as they now get caught by my users route before they have a chance to resolve.

I'm seeing the following errors as a result:

ActiveRecord::RecordNotFound (can't find record with friendly id: "pagination"):
ActiveRecord::RecordNotFound (can't find record with friendly id: "sidebar"):
etc...

Is it possible to namespace the madmin assets to avoid this?

@kjf
Copy link
Author

kjf commented Dec 29, 2024

As a quick follow up. It seems this is caused by cloudfront which is configured as an asset host.

Looking at the CSS file that's served up by cloudfront I can see this:

@import url(https://d1lgo521xfi61.cloudfront.net/../trix.css);
@import url(https://d1lgo521xfi61.cloudfront.net/actiontext.css);
@import url(https://d1lgo521xfi61.cloudfront.net/reset.css);
@import url(https://d1lgo521xfi61.cloudfront.net/sidebar.css);
@import url(https://d1lgo521xfi61.cloudfront.net/buttons.css);
@import url(https://d1lgo521xfi61.cloudfront.net/forms.css);
@import url(https://d1lgo521xfi61.cloudfront.net/tables.css);
@import url(https://d1lgo521xfi61.cloudfront.net/pagination.css);

So it's not respecting the madmin namespace.

@excid3
Copy link
Owner

excid3 commented Feb 8, 2025

The assets are namespaced under madmin already, but setting an asset host may affect how that's handled. I'll have to look into that.

@excid3
Copy link
Owner

excid3 commented Feb 8, 2025

@kjf give #246 a try? I think using the relative paths was the culprit.

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

Successfully merging a pull request may close this issue.

2 participants