Hello,
I thinked about an issue for 2 days but without any result, it’s about url: [host: host]
in config.exs
, sorry Iam new to Phoenix and to Web Development in general so to describe the problem in short :
Consider I want to create a website from my home server, first I need to rent a domain (right ?) for example myapp.com
, then I will add my server ip
and hostname
to the hosting website (.com
), so by this each time a client tap www.myapp.com/....
in the browser search bar, he will be redirected to my server via dns
(right ?) , my question is:
Where will be url: [host: host]
used or concerned here ? and what is the real usecase of it ?
Thank you in advance.
if you have registered the domain name myapp.com
, you would set url: [host: "myapp.com"]
you can set host to “localhost” to run in on your local machine in your dev config
1 Like
The purpose of this configuration key is for URL generation. This means that when you ask Phoenix Router’s helper functions for the full URL, such as Routes.your_route_url(...)
, it will use this domain to form the URL.
3 Likes
Thanks @Nicd, I think this is one of the usecases, but how about others like its use by the Web Search Engines and Web Crawlers ?