Deploying ReactJS with Axios on Ubuntu

We have 2 different server:

Front end:
Back end:

The react part is just the that I am trying to deploy

Those 2 are connected using Axios, it works fine on my local using npm start
by putting proxy: on the package.json


When I deploy it the REST API connection using axios couldn’t work at all

1st attempt: serving the apache to run to the build folder
Error: homepage loaded, but 404 on all REST call, upon inspecting it tries to access instead of that it supposed to access

2nd attempt: running on the serve -s build as suggested
Error: homepage loaded, but all REST call returns this text You need to enable JavaScript to run this app. on the body

3rd attempt: removing proxy on package.json, then put the full url on all axios call
Error: homepage loaded, all REST call got CORS error and doesn’t run

Can anyone let me know how to deploy react and Axios correctly if the backend sits on a different domain name?

As requested by @technogeek1995, here is the Axios request header

  axios.get('/login', {
    'headers': {
      'Authorization': `Basic ${token}`

I don’t have any other settings, other than that and the proxy: and the above Axios code

I’ve added the CORS header as suggested, still no luck. The same error CORS issue. I have also made sure I have enabled the a2enmod header

# Always set these headers.
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, author    ization, accept, client-security-token"

# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request.
RewriteEngine On
RewriteRule ^(.*)$ $1 [R=200,L]

Source: ReactJs