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

Link to static content using static_path rahter than static_url #448

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haakonst
Copy link

@haakonst haakonst commented Aug 2, 2018

I'm developing an application that responds to requests on multiple host names having several different subdomain names under the same main (second-level) domain (for example customer-a.example.org, customer-b.example.org, customer-c.example.org). The setup is described in this blog post: https://blog.gazler.com/blog/2015/07/18/subdomains-with-phoenix/. However, the application does not respond to requests on the main (second-level) domain name (in this example: example.org).

Since ExAdmin links to static resources (JavaScript and CSS) used by the templates active_admin.html.eex and admin_lte2.html.eex by using the function static_url, these resources fail to load in my application. The generated links don't include the subdomain name, like this:

https://example.org/css/admin_lte2-4b903242aada0f319f0e076944273dfc.css?vsn=d
https://example.org/js/jquery.min-cfb4c11ee8b6c29969a2a615604d49f9.js?vsn=d

Is there a reason why static_url is used rather than static_path? This PR suggests switching to using static_path which would be really helpful for applications using subdomains in this way.

Otherwise links to static resources in ExAdmin will not work in applications
that only responds to requests for subdomains of the domain name and not the
main (second-level) domain itself, for example as described here:

https://blog.gazler.com/blog/2015/07/18/subdomains-with-phoenix/
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 this pull request may close these issues.

None yet

1 participant