hi, I am trying to connect to the API service from another device on my LAN (thus can’t use localhost, i.e. 127.0.0.1), when connecting with the explicit IP, I got connection refuse error, how do I configure the peer to accept both localhost and this explicit address?
Okay, not too experienced with this one, so maybe someone else will chime in. But, here is some info on enabling ports on your development machine,
If on Mac, https://discussions.apple.com/docs/DOC-13841
A simple route I often use is just Ngrok, https://ngrok.com/.
hmmm… that is not exactly what I am trying to do. I don’t want to expose my development machine to the internet, just want to access it within my internal network. The IP address is already well-known and accessible within the LAN, no need to use
ngrok I think…
I just tried to change the textile config:
API.HTTPHeaders.Access-Control-Allow-Origin, and it seems to work! I can connect to the API service with the LAN IP, regardless if my app is originated from localhost (because localhost is already in the allow origin list) or the other device within the LAN.
Don’t know if there is a better way to do this, but I am reasonably happy about this solution, thanks for having a flexible config!
Yup. That value in the config is actually an array. So you can put multiple addresses in there, including local host, known ips, known base urls, etc. So yes this is the the right way to do it, your use-case is exactly what it was designed to support