title: React-router how to redirect to server port
body: <p>Hi I am using react router v4. </p>
  
  <p>My React runs on port 3000, while express server runs on port 8080. The Redirect segment of the code below brings me to <code>localhost:3000/http://localhost:8080/auth/login</code>. </p>
  
  <p>I have <code>"proxy": "localhost:8080"</code> in my React's package.json already. It doesn't work.</p>
  
  <p>How can I redirect from <code>localhost:3000</code> to <code>localhost:8080/auth/login</code>?</p>
  
  <p><strong>App.js</strong></p>
  
  <pre><code>class App extends Component {
    constructor(props) {
      super(props);
      this.props.fetchProducts();
      this.props.fetchUser();
    }
  
    render() {
      return (
        &lt;Switch&gt; 
          &lt;Route exact path='/cart' render={() =&gt; this.props.isLoggedIn ? 
            &lt;Checkout /&gt; : 
            &lt;Redirect to='http://localhost:8080/auth/login' /&gt; 
          } /&gt;
          &lt;Route exact path='/user/account/profile' render={() =&gt; &lt;Profile /&gt;} /&gt;
          &lt;Route exact path='/' render={() =&gt; &lt;MainPage /&gt;} /&gt;
        &lt;/Switch&gt;
      );
    }
  }
  </code></pre>
  
  <p><strong>Client's package.json</strong></p>
  
  <pre><code>{
    "name": "client",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
      "@material-ui/core": "^3.6.2",
      "prop-types": "^15.6.2",
      "react": "^16.4.1",
      "react-dom": "^16.4.1",
      "react-redux": "^5.0.7",
      "react-router-dom": "^4.3.1",
      "react-scripts": "^2.1.3",
      "redux": "^4.0.0",
      "redux-logger": "^3.0.6",
      "redux-thunk": "^2.3.0"
    },
    "proxy": "http://localhost:8080",
    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test --env=jsdom",
      "eject": "react-scripts eject"
    },
    "browserslist": [
      "&gt;0.2%",
      "not dead",
      "not ie &lt;= 11",
      "not op_mini all"
    ]
  }
  
  </code></pre>