I was trying to access the hostname to decide where api requests should go, e.g.
in my code if it’s hosted on customdomain.netlify.com I’d make calls to customdomain.netlify.com/api,
if it’s a local dev environment with the URL being localhost:8888 I’d make calls to localhost:8888/api
and I was thinking of using the $URL provided by Netlify to achieve it
However, after trying out some deploys I realized $URL is pretty much always the publicly deployed URL and won’t meet my purpose.
I ended up simply using the js snippet location.origin to get what I needed instead.
Thanks for looking into this tho, I appreciate it. We can close this issue now
Thanks for clarifying @sid, that was where I was getting and your solution is the better way of checking the URL origin. Glad you were able to resolve that!