title: How to transfer a webapp to https from the cloudflare?
body: <p>It was not in my plans to install the server as nginx, so my web application is launched on the node.js server. There, similar constructions are used to refer to certain pages:</p>
  <hr />
  <p>on server:</p>
  <pre><code>if(process.env.NODE_ENV === 'production') {
      app.use('/', express.static(path.join(__dirname, '../', 'client', 'dist')))
  }
  app.use('/api/bonds', bonds);
  const port = 80;
  </code></pre>
  <p>on client:</p>
  <pre><code>const url = '1.2.3.4:80/api/bonds';
  class BondsService {
      static getBonds() {
          return new Promise(async (resolve, reject) =&gt; {
              try {
                  const res = await axios.get(url);
                  const data = res.data;
                  resolve(data.map(bond =&gt; ({
                      ...bond
                  })));
              } catch (e) {
                  reject(e);
              }
          })
      }
  </code></pre>
  <p>I transferred my domain to cloudflare, and set the free SSL certificate to flexible mode. When I access the application through http, everything works, but when does the http give such an error:</p>
  <blockquote>
  <p>xhr.js:178 Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://1.2.3.4/api/bonds'. This request has been blocked; the content must be served over HTTPS.</p>
  </blockquote>
  <p>How can you fix it?</p>