Curl and Laravel, always redirects
<p>I am trying to do a simple simple curl to a Laravel (5.2) app running on my machine:</p>

<pre><code>curl -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1" http://192.168.1.65:8000/pt
</code></pre>

<p>With this result:</p>

<p><strong>The request header</strong>:</p>

<pre><code>*   Trying 192.168.1.65...
* Connected to 192.168.1.65 (192.168.1.65) port 8000 (#0)
&gt; GET /pt HTTP/1.1
&gt; Host: 192.168.1.65:8000
&gt; Accept: */*
&gt; User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
</code></pre>

<p><strong>The response header and body</strong>:</p>

<pre><code>&lt; HTTP/1.1 302 Found
&lt; Host: 192.168.1.65:8000
&lt; Connection: close
&lt; X-Powered-By: PHP/7.0.8-0ubuntu0.16.04.2
&lt; Set-Cookie: lang=pt; expires=Fri, 04-Nov-2016 08:53:50 GMT; Max-Age=2592000; path=/
&lt; Cache-Control: no-cache
&lt; Location: http://192.168.1.65:8000/pt
&lt; Content-Type: text/html; charset=UTF-8
&lt; Date: Wed, 05 Oct 2016 08:53:50 GMT
&lt; Set-Cookie: XSRF-TOKEN=eyJpdiI6IjNReFJiRFpYOG5USEgzaVZ4YWQ5OXc9PSIsInZhbHVlIjoiblBFU0FqRjJ3WFMyajJHZnBlUEMzT2lXK2ZDaGpTVDJnQnZZSXdSNUhTUHQ2QmxjcUZGUDFOUit0NzFKeUxMY28zaUl0VlVBNGtUMUJmYnlxWisrT3c9PSIsIm1hYyI6IjZjZmFlZTcwNGMxOTE1OGM2NjE1ZWM5OWViZjEzMjZmYzIwZTljNWMwYWY1ZmQzZGI3Y2FjZDdiM2Q4Y2IxMmQifQ%3D%3D; expires=Wed, 05-Oct-2016 10:53:50 GMT; Max-Age=7200; path=/
&lt; Set-Cookie: laravel_session=eyJpdiI6IjJ5MTMwYXBpVDlqRTZ6U2NmNjBWb3c9PSIsInZhbHVlIjoiTm10QklTZTAydURkeU1kSm9Eam1UaGg1RlpvQWpncTBJTmRSd2poT01ORVRUa2l3MzNSSjJZTStPMWpGTVdYQ0JFRkt3M2ZUd3NRYVNTS3JLQkpLckE9PSIsIm1hYyI6IjM5MmQ2YzEzNDYwM2M5YTc1MzI0ODZmMjBiYWZiNmYyM2Q4NzE0ZTEyOWE3NWUzZjRjMGIxMGFjMGVjZDgzNGIifQ%3D%3D; expires=Wed, 05-Oct-2016 10:53:50 GMT; Max-Age=7200; path=/; HttpOnly
&lt; 
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset="UTF-8" /&gt;
        &lt;meta http-equiv="refresh" content="1;url=http://192.168.1.65:8000/pt" /&gt;

        &lt;title&gt;Redirecting to http://192.168.1.65:8000/pt&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        Redirecting to &lt;a href="http://192.168.1.65:8000/pt"&gt;http://192.168.1.65:8000/pt&lt;/a&gt;.
    &lt;/body&gt;
* Closing connection 0
</code></pre>

<p>I find this really weird since if i use the lib requests from python 3.x: </p>

<pre><code>import requests

headers = {'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1'}
req = requests.get('http://192.168.1.65:8000/pt', headers=headers)
print(req.text)
</code></pre>

<p>The response is all html from the page (this is what is supose to happen)</p>

<p>PS: I also used the <code>-L</code> flag with me <code>curl</code> so it can fallow redirects but it appears to end up in an infinite loop (<code>curl: (47) Maximum (50) redirects followed</code>)</p>

<p>Why is this hapening? How to solve it?</p>