title: Advice on how to set up a connection between nancy service and server
body: <p>I am working on a project whereby we have sites (developed with ruby on rails) hosted on an Ubuntu server using tomcat. We want these sites to make HTTP calls to a service developed using Nancy. We have this working locally whereby the service is hosted on a machine that we can call within our network. We cannot however get it working when live. Here is an example call:</p>
  
  <pre><code>def get_call(routePath)
    started_at = Time.now
    enc_url = URI.encode("#{settings.service_endpoint}#{routePath}")
    uri = URI.parse(enc_url)
    http = Net::HTTP.new(uri.host, uri.port)   
    req = Net::HTTP::Get.new(uri.request_uri) 
    resp = http.request(req)
    logger.bench 'SERVICE - GET', started_at, routePath
    return resp if response_ok?(resp)
  end
  </code></pre>
  
  <p>When working locally the settings are as follows:</p>
  
  <pre><code>settings.service_endpoint = http://10.10.10.27:7820
  routePath = /Customers
  </code></pre>
  
  <p>When we upload it to the server we use the following:</p>
  
  <pre><code>settings.service_endpoint = http://127.0.0.1:24099
  routePath = /Customers
  </code></pre>
  
  <p>We currently get the following error:</p>
  
  <pre><code>SocketError at /register
  initialize: name or service not know
  </code></pre>
  
  <p>with the following line being highlighted:</p>
  
  <pre><code>resp = http.request(req)
  </code></pre>
  
  <p>Are we completely wrong with the IP being called. Should it be 127.0.0.1, localhost. 10.10.10.27 or something entirely different? The strange thing is we can do a GET call via telnet in our Ubuntu server (telnet 127.0.0.1 24099) so that must mean the server can make the calls but the site hosted on the server cannot. Do we need to include a HTTP proxy (have read some reference to that but dont really know if its needed).</p>
  
  <p>Apologies if its obvious but we have never tried anything like this before so its all very perplexing. Any further information required just let me know.</p>