title: Axios baseUrl on EC2, reference Ip address
body: <p>I want to deploy an app on EC2 instance, but facing a problem with axios calls. Everything worked fine in a development environment because on localhost, however. Once I deployed this app onto EC2 instance, I face a problem of <code>POST http://localhost:3000/stop 0 ()</code> whenever I press on a stop button or anything else on the website.</p>
  
  <p>The entire app developed with next.js and there I have installed axios which during development was configured to be</p>
  
  <pre><code>import axios from 'axios'
  
  const instance = axios.create({
      baseURL: 'http://localhost:3000'
  })
  
  export default instance;
  </code></pre>
  
  <p>I know I need to change this baseURL to IP address provided by EC2, but how can I do so dynamically so that baseURL gets the current global IP address directly?</p>
  
  <p>Or how should I approach this problem?</p>