Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Referer header to point to the original host name #1857

Merged
merged 1 commit into from Oct 24, 2015

Conversation

simov
Copy link
Member

@simov simov commented Oct 23, 2015

I have no idea how this has gone unnoticed for so long. Here is how our single test regarding that behavior looks like before and after the change using request-debug:

should have the referer when following redirect by default

{ request: 
   { debugId: 1,
     uri: 'http://localhost:6767/temp',
     method: 'POST',
     headers: 
      { cookie: 'foo=bar',
        host: 'localhost:6767',
        'content-length': 0 } } }
{ redirect: 
   { debugId: 1,
     statusCode: 301,
     headers: 
      { location: 'http://localhost:6767/temp_landing',
        'set-cookie': [Object],
        date: 'Fri, 23 Oct 2015 08:38:55 GMT',
        connection: 'close',
        'transfer-encoding': 'chunked' },
     uri: 'http://localhost:6767/temp_landing' } }
{ request: 
   { debugId: 1,
     uri: 'http://localhost:6767/temp_landing',
     method: 'GET',
     headers: 
      { cookie: 'foo=bar; ham=eggs',
-        referer: 'http://localhost:6767/temp_landing',
+        referer: 'http://localhost:6767/temp',
        host: 'localhost:6767' } } }
{ response: 
   { debugId: 1,
     headers: 
      { 'x-response': 'GET temp_landing',
        date: 'Fri, 23 Oct 2015 08:38:55 GMT',
        connection: 'close',
        'transfer-encoding': 'chunked' },
     statusCode: 200,
     body: 'GET temp_landing' } }

Referer header should point to the host name of the original resource when redirecting.

Hopefully that's the correct behavior.

@simov simov mentioned this pull request Oct 23, 2015
simov added a commit that referenced this pull request Oct 24, 2015
Fix Referer header to point to the original host name
@simov simov merged commit d18cb48 into request:master Oct 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant