title: Debugging with local instance and authentication cookies
body: <p>So, I've recently taken over the front-end of a project in which the previous front-end developer always did his debugging with a localhost instance connecting to a remote staging back-end.</p>
  
  <p>Right now we are improving some security issues and are using CSRF tokens.</p>
  
  <p>For each POST,PUT,DELETE request, I'm first <code>GET</code>ting a csrf endpoint, which sets a JSESSIONID HttpOnly cookie and returns a CSRF token in the response body. For the subsequent request the CSRF token goes into the request header and the cookie of course gets sent automatically of course.</p>
  
  <p>Now,.. my code works fine deployed on the remote staging front-end. But, this new functionality has totally prevented me from debugging with a local instance, because the cookie wont work when I <code>GET</code> the CSRF token from localhost, because this is a different domain of course.
  This requires me to deploy every single change of code to the staging front end. Very uncomfortable workflow when performing the usual trial-and-error fix.</p>
  
  <p>Adding the remote as a localhost alias to my hosts file also doesn't work, because this routes all my requests to the remote to my own machine, which doesn't run a local instance of the remote.</p>
  
  <p>I would've thought there would be a Chrome extension or something like that for problems like these, but since I couldn't find any I wondered if I'm missing a very obvious point here.</p>