title: How to resolve an url by fetch & redirect without refresh with react
body: <p>I need to fetch the current url in my react application because our front/nginx may respond with a redirect which won't be hit if user has the service-worker active..</p>
  
  <p>therefor I currently have this logic in my 404 component on didMount. </p>
  
  <pre><code>fetch('/test/page/xxxx/', {redirect: 'follow'}).then(res =&gt; {
    if(res.status === 200 &amp;&amp; res.redirected) {
      console.log(res)
      // this.props.push(res.url)
      // window.location.replace(res.url)
      // window.location.hash = res.url
      console.log('Redirected to ' + res.url)
    }
  })
  </code></pre>
  
  <p>the res.url that I get back in the respons is a full url ex: <a href="https://example.net/xxx/xxx/xxxx" rel="nofollow noreferrer">https://example.net/xxx/xxx/xxxx</a> which makes it hard for me to use push from react-router-redux because it expects a relative url. Can anyone help me with a regex that can get the slugs from the res.url or does anyone have any other idea how to solve this problem?</p>