<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>


<p dir="auto">Route redirect on signout should work as expected.</p>
<h2 dir="auto">Current Behavior</h2>


<p dir="auto">Signout won't work the first time if user is already signed in when loading the page.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>


<ol dir="auto">
<li>Signin</li>
<li>Reload the page</li>
<li>Signout won't work the first time</li>
</ol>
<h2 dir="auto">Context</h2>


<h2 dir="auto">Your Environment</h2>

<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>5.0.0</td>
</tr>
<tr>
<td>node</td>
<td>8.9.4</td>
</tr>
<tr>
<td>OS</td>
<td>osx 10.11.6</td>
</tr>
<tr>
<td>browser</td>
<td>chrome</td>
</tr>
<tr>
<td>etc</td>
<td></td>
</tr>
</tbody>
</table>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">In dev mode, navigating to <code class="notranslate">/blog/posts/my-post-title</code> should be picked up by the router as a destination that <strong>will eventually</strong> be available on static export.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">In dev mode, navigating to <code class="notranslate">/blog/posts/my-post-title</code> is not be picked up by the router, and you get a 404 where a static HTML file would normally be located after exporting the static site.</p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<ol dir="auto">
<li>Use the following <code class="notranslate">next.config.js</code>:</li>
</ol>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// next.config.js
module.exports = {
  exportPathMap: function () {
    return {
      &quot;/&quot;: { page: &quot;/&quot; },
      &quot;/p/hello-nextjs&quot;: { page: &quot;/post&quot;, query: { title: &quot;hello-nextjs&quot; } },
    }
  },
}"><pre class="notranslate"><span class="pl-c">// next.config.js</span>
<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-en">exportPathMap</span>: <span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-kos">{</span>
      <span class="pl-s">"/"</span>: <span class="pl-kos">{</span> <span class="pl-c1">page</span>: <span class="pl-s">"/"</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-s">"/p/hello-nextjs"</span>: <span class="pl-kos">{</span> <span class="pl-c1">page</span>: <span class="pl-s">"/post"</span><span class="pl-kos">,</span> <span class="pl-c1">query</span>: <span class="pl-kos">{</span> <span class="pl-c1">title</span>: <span class="pl-s">"hello-nextjs"</span> <span class="pl-kos">}</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span></pre></div>
<ol start="2" dir="auto">
<li>Run the dev server with <code class="notranslate">next</code></li>
<li>Navigate to <code class="notranslate">localhost:3000/p/hello-nextjs</code></li>
<li>The result will be a 404</li>
</ol>
<h2 dir="auto">Context</h2>
<p dir="auto">The expected behavior is extremely relevant to using Next to build static websites. One key component to developing a static website is the ability for the local development server to resemble as closely as possible the conditions where the static site will be served. In this case, I would expect that the paths exported from <code class="notranslate">exportPathMap</code> would be used to serve the correct page.</p>
<p dir="auto">You may be thinking that <code class="notranslate">next-routes</code> + <code class="notranslate">&lt;Link as='...' /&gt;</code> is a good solution to this problem, where the browser push state masks navigation to <code class="notranslate">/blog/posts/my-post-title</code> with something like <code class="notranslate">blog-post?slug=my-post-title</code>, but this only works when navigating from a root page or index, not when reloading or opening a new window.</p>