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

HTTP 503 status #13

Closed
dcromster opened this issue Sep 6, 2017 · 5 comments
Closed

HTTP 503 status #13

dcromster opened this issue Sep 6, 2017 · 5 comments

Comments

@dcromster
Copy link

dcromster commented Sep 6, 2017

Hello!
When I try make request to http://emls.ru/flats/?query=s/1/r2/1/is_auction/2/type/2/place/address/reg/2/dept/2/dist/9/sort1/1/dir1/2/sort2/3/dir2/1//interval/5 I got 503, but from browser 200.

I think problem with User-Agent. How I can set UA like browser?

@talmobi
Copy link
Owner

talmobi commented Sep 6, 2017

Refer to the https://github.com/request/request#custom-http-headers to specify your own headers ( like User-Agent ).

basically: tr.request({ url: 'google.com', headers: { 'user-agent': 'giraffe' }}, function ( err, response, body ) { /*...*/ })

That url works for me fine for tor-request and request ( status 200 )

var tr = require( './index.js' )
var request = require( 'request' )

var url = 'http://emls.ru/flats/?query=s/1/r2/1/is_auction/2/type/2/place/address/reg/2/dept/2/dist/9/sort1/1/dir1/2/sort2/3/dir2/1//interval/5'

console.log( 'making request: ' )
request( url, function ( err, response, body ) {
  if ( err ) throw err
  body0 = body

  console.log( 'statusCode: ' + response.statusCode )
  tr.request( url, function ( err, response, body ) {
    if ( err ) throw err

    console.log( 'statusCode: ' + response.statusCode )
  })
})

It's possible that some servers identify tor nodes ( by their IP address ) and block them indefinitely -- you may have been connected to a tor IP that was blocked by the server -- try to renew your tor IP ( by either restart the tor daemon or enabling the tor control port and sending a renew signal ).

@dcromster
Copy link
Author

It works! Thank You!

Maybe this question and answer need add to docs?

@knoxcard
Copy link
Contributor

Close issue?

@talmobi
Copy link
Owner

talmobi commented Mar 25, 2018

Added small usage example for this to the README

https://github.com/talmobi/tor-request#custom-headers

@talmobi talmobi closed this as completed Mar 25, 2018
@knoxcard
Copy link
Contributor

@talmobi - Nice work bud!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants