Giter Club home page Giter Club logo

Comments (8)

nfriedly avatar nfriedly commented on July 1, 2024

Can you set the DEBUG=* and run it again (run DEBUG=* npm start) and give me the logs from a request? (There should be a lot more then.)

from node-unblocker.

nfriedly avatar nfriedly commented on July 1, 2024

Oh, and, I think the fix in your case might be to set config.host="proxy.site.com" (or whatever your domain name is) - but I'd still appreciate the log output even if that does fix it for you, because it should at least give a more helpful error message.

from node-unblocker.

Porco-Rosso avatar Porco-Rosso commented on July 1, 2024

I'll try running the option you set, it goes under the following correct?

var unblockerConfig = {
    prefix: '/proxy/',
    responseMiddleware: [
        googleAnalyticsMiddleware
    ]
};

here is the output without the host set:

> [email protected] start /root/node-unblocker/proxy
> ./node_modules/gatling/gatling.js ./app.js

  express:application set "x-powered-by" to true +0ms
  express:application set "etag" to 'weak' +2ms
  express:application set "etag fn" to [Function: wetag] +1ms
  express:application set "env" to 'development' +1ms
  express:application set "query parser" to 'extended' +0ms
  express:application set "query parser fn" to [Function: parseExtendedQueryString] +0ms
  express:application set "subdomain offset" to 2 +0ms
  express:application set "trust proxy" to false +0ms
  express:application set "trust proxy fn" to [Function: trustNone] +0ms
  express:application booting in development mode +0ms
  express:application set "view" to [Function: View] +1ms
  express:application set "views" to '/root/node-unblocker/proxy/views' +0ms
  express:application set "jsonp callback name" to 'callback' +0ms
  unblocker:core Unblocker initialized, config:  +0ms { prefix: '/proxy/',
  responseMiddleware: 
   [ [Function: debugMiddleware],
     [Function: hsts],
     [Function: debugMiddleware],
     [Function: hpkp],
     [Function: debugMiddleware],
     [Function: csp],
     [Function: debugMiddleware],
     [Function: proxyRedirects],
     [Function: debugMiddleware],
     [Function: decompressResponse],
     [Function: debugMiddleware],
     [Function: decodeCharset],
     [Function: debugMiddleware],
     { [Function: prefixUrls]
       rewriteUrls: [Function: rewriteUrls],
       createStream: [Function: createStream] },
     [Function: debugMiddleware],
     [Function: rewriteCookiesAndLinks],
     [Function: debugMiddleware],
     { [Function: metaRobots] createStream: [Function: createStream] },
     [Function: debugMiddleware],
     [Function: googleAnalyticsMiddleware],
     [Function: debugMiddleware],
     [Function: contentLength],
     [Function: debugMiddleware] ],
  host: null,
  requestMiddleware: 
   [ [Function: debugMiddleware],
     [Function: hostHeader],
     [Function: debugMiddleware],
     [Function: proxyReferer],
     [Function: debugMiddleware],
     [Function: acceptableCompression],
     [Function: debugMiddleware],
     [Function: redirectCookiesWith],
     [Function: debugMiddleware] ],
  standardMiddleware: true,
  processContentTypes: 
   [ 'text/html',
     'application/xml+xhtml',
     'application/xhtml+xml',
     'text/css' ] }
  express:router use / query +5ms
  express:router:layer new / +0ms
  express:router use / expressInit +1ms
  express:router:layer new / +0ms
  express:router use / handleRequest +0ms
  express:router:layer new / +0ms
  express:router use / serveStatic +0ms
  express:router:layer new / +0ms
  express:router:route new /no-js +0ms
  express:router:layer new /no-js +0ms
  express:router:route get /no-js +0ms
  express:router:layer new / +0ms
Gatling master thread setting up workers to run /root/node-unblocker/proxy/app.js and listen on port 8080
  express:application set "x-powered-by" to true +0ms
  express:application set "etag" to 'weak' +4ms
  express:application set "etag fn" to [Function: wetag] +2ms
  express:application set "env" to 'development' +1ms
  express:application set "query parser" to 'extended' +0ms
  express:application set "query parser fn" to [Function: parseExtendedQueryString] +0ms
  express:application set "subdomain offset" to 2 +0ms
  express:application set "trust proxy" to false +1ms
  express:application set "trust proxy fn" to [Function: trustNone] +0ms
  express:application booting in development mode +0ms
  express:application set "view" to [Function: View] +1ms
  express:application set "views" to '/root/node-unblocker/proxy/views' +0ms
  express:application set "jsonp callback name" to 'callback' +0ms
  unblocker:core Unblocker initialized, config:  +0ms { prefix: '/proxy/',
  responseMiddleware: 
   [ [Function: debugMiddleware],
     [Function: hsts],
     [Function: debugMiddleware],
     [Function: hpkp],
     [Function: debugMiddleware],
     [Function: csp],
     [Function: debugMiddleware],
     [Function: proxyRedirects],
     [Function: debugMiddleware],
     [Function: decompressResponse],
     [Function: debugMiddleware],
     [Function: decodeCharset],
     [Function: debugMiddleware],
     { [Function: prefixUrls]
       rewriteUrls: [Function: rewriteUrls],
       createStream: [Function: createStream] },
     [Function: debugMiddleware],
     [Function: rewriteCookiesAndLinks],
     [Function: debugMiddleware],
     { [Function: metaRobots] createStream: [Function: createStream] },
     [Function: debugMiddleware],
     [Function: googleAnalyticsMiddleware],
     [Function: debugMiddleware],
     [Function: contentLength],
     [Function: debugMiddleware] ],
  host: null,
  requestMiddleware: 
   [ [Function: debugMiddleware],
     [Function: hostHeader],
     [Function: debugMiddleware],
     [Function: proxyReferer],
     [Function: debugMiddleware],
     [Function: acceptableCompression],
     [Function: debugMiddleware],
     [Function: redirectCookiesWith],
     [Function: debugMiddleware] ],
  standardMiddleware: true,
  processContentTypes: 
   [ 'text/html',
     'application/xml+xhtml',
     'application/xhtml+xml',
     'text/css' ] }
  express:router use / query +12ms
  express:router:layer new / +1ms
  express:router use / expressInit +0ms
  express:router:layer new / +0ms
  express:router use / handleRequest +1ms
  express:router:layer new / +0ms
  express:router use / serveStatic +1ms
  express:router:layer new / +0ms
  express:router:route new /no-js +0ms
  express:router:layer new /no-js +0ms
  express:router:route get /no-js +0ms
  express:router:layer new / +0ms
Gatling worker thread 1 up and listening
  express:router dispatching GET / +19s
  express:router query  : / +1ms
  express:router expressInit  : / +1ms
  express:router handleRequest  : / +0ms
  express:router serveStatic  : / +1ms
  send stat "/root/node-unblocker/proxy/public/index.html" +1ms
  send pipe "/root/node-unblocker/proxy/public/index.html" +1ms
  send modified Mon, 16 Nov 2015 21:46:38 GMT +0ms
  send etag W/"ef9-15112439630" +0ms
  send content-type text/html +0ms
  send not modified +1ms
  express:router dispatching GET /proxy/http:/google.com +4s
  express:router query  : /proxy/http:/google.com +0ms
  express:router expressInit  : /proxy/http:/google.com +0ms
  express:router handleRequest  : /proxy/http:/google.com +1ms
  unblocker:proxy proxying GET http:/google.com +24s
  unblocker:middleware starting request middleware stack for  http:/google.com +1ms
  unblocker:middleware stream added +0ms
  unblocker:middleware setting up hostHeader +0ms
  unblocker:middleware setting up proxyReferer +0ms
  unblocker:middleware setting up acceptableCompression +1ms
  unblocker:middleware setting up redirectCookiesWith +0ms
  unblocker:middleware all request middleware setup +0ms
  unblocker:proxy sending remote request:  +0ms { host: null,
  port: null,
  path: '/google.com',
  method: 'GET',
  headers: 
   { 'x-forwarded-for': '93.32.114.227',
     connection: 'keep-alive',
     host: null,
     accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
     'upgrade-insecure-requests': '1',
     'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',
     dnt: '1',
     referer: 'http://proxy.omnipus.ga/',
     'accept-encoding': 'gzip',
     'accept-language': 'en-US,en;q=0.8,fr;q=0.6' } }
  unblocker:proxy proxying 404 response for http:/google.com +7ms
  unblocker:middleware stream added +0ms
  unblocker:middleware setting up hsts +0ms
  unblocker:middleware setting up hpkp +0ms
  unblocker:middleware setting up csp +0ms
  unblocker:middleware setting up proxyRedirects +0ms
  unblocker:middleware setting up decompressResponse +0ms
  unblocker:middleware setting up decodeCharset +0ms
  unblocker:charsets decoding iso-8859-1 charset via iconv stream +9ms
  unblocker:middleware stream added +1ms
  unblocker:middleware setting up prefixUrls +0ms
  unblocker:url-prefixer prefixing all urls with /proxy/ +0ms
  unblocker:middleware stream added +0ms
  unblocker:middleware setting up rewriteCookiesAndLinks +0ms
error TypeError: Cannot read property 'split' of null
    at registeredDomain (/root/node-unblocker/proxy/node_modules/unblocker/node_modules/tld/lib/tld.js:80:23)
    at Object.exports.registered (/root/node-unblocker/proxy/node_modules/unblocker/node_modules/tld/lib/tld.js:120:12)
    at rewriteCookiesAndLinks (/root/node-unblocker/proxy/node_modules/unblocker/lib/cookies.js:97:27)
    at /root/node-unblocker/proxy/node_modules/unblocker/lib/proxy.js:66:13
    at arraySome (/root/node-unblocker/proxy/node_modules/unblocker/node_modules/lodash/index.js:1493:13)
    at Function.some (/root/node-unblocker/proxy/node_modules/unblocker/node_modules/lodash/index.js:7051:14)
    at proxyResponse (/root/node-unblocker/proxy/node_modules/unblocker/lib/proxy.js:65:43)
    at ClientRequest.<anonymous> (/root/node-unblocker/proxy/node_modules/unblocker/lib/proxy.js:42:17)
    at ClientRequest.g (events.js:260:16)
    at emitOne (events.js:77:13)
  express:application set "x-powered-by" to true +0ms
  express:application set "etag" to 'weak' +3ms
  express:application set "etag fn" to [Function: wetag] +1ms
  express:application set "env" to 'development' +0ms
  express:application set "query parser" to 'extended' +0ms
  express:application set "query parser fn" to [Function: parseExtendedQueryString] +0ms
  express:application set "subdomain offset" to 2 +1ms
  express:application set "trust proxy" to false +0ms
  express:application set "trust proxy fn" to [Function: trustNone] +0ms
  express:application booting in development mode +0ms
  express:application set "view" to [Function: View] +0ms
  express:application set "views" to '/root/node-unblocker/proxy/views' +0ms
  express:application set "jsonp callback name" to 'callback' +1ms
  unblocker:core Unblocker initialized, config:  +0ms { prefix: '/proxy/',
  responseMiddleware: 
   [ [Function: debugMiddleware],
     [Function: hsts],
     [Function: debugMiddleware],
     [Function: hpkp],
     [Function: debugMiddleware],
     [Function: csp],
     [Function: debugMiddleware],
     [Function: proxyRedirects],
     [Function: debugMiddleware],
     [Function: decompressResponse],
     [Function: debugMiddleware],
     [Function: decodeCharset],
     [Function: debugMiddleware],
     { [Function: prefixUrls]
       rewriteUrls: [Function: rewriteUrls],
       createStream: [Function: createStream] },
     [Function: debugMiddleware],
     [Function: rewriteCookiesAndLinks],
     [Function: debugMiddleware],
     { [Function: metaRobots] createStream: [Function: createStream] },
     [Function: debugMiddleware],
     [Function: googleAnalyticsMiddleware],
     [Function: debugMiddleware],
     [Function: contentLength],
     [Function: debugMiddleware] ],
  host: null,
  requestMiddleware: 
   [ [Function: debugMiddleware],
     [Function: hostHeader],
     [Function: debugMiddleware],
     [Function: proxyReferer],
     [Function: debugMiddleware],
     [Function: acceptableCompression],
     [Function: debugMiddleware],
     [Function: redirectCookiesWith],
     [Function: debugMiddleware] ],
  standardMiddleware: true,
  processContentTypes: 
   [ 'text/html',
     'application/xml+xhtml',
     'application/xhtml+xml',
     'text/css' ] }
  express:router use / query +5ms
  express:router:layer new / +1ms
  express:router use / expressInit +0ms
  express:router:layer new / +0ms
  express:router use / handleRequest +0ms
  express:router:layer new / +0ms
  express:router use / serveStatic +1ms
  express:router:layer new / +0ms
  express:router:route new /no-js +0ms
  express:router:layer new /no-js +0ms
  express:router:route get /no-js +0ms
  express:router:layer new / +0ms
Gatling worker thread 2 up and listening

from node-unblocker.

nfriedly avatar nfriedly commented on July 1, 2024

Yes for the host config, although, it looks like this is an nginx thing. I think you need to add merge_slashes off; to your config. (Probably right after the keepalive_timeout.)

Source: http://ask.webatall.com/nginx/18045_nginx-how-to-keep-double-slashes-in-urls.html

I'll add a note to the readme if that works for you.

from node-unblocker.

Porco-Rosso avatar Porco-Rosso commented on July 1, 2024

no dice so far.

I have host: 'proxy.omnipus.ga' in the app.js and merge_slashes off; in nginx but nothing seems to change.

Edit: host: 'proxy.omnipus.ga' obviously broke it while connecting from local ip, so I removed it.
As you said it is probably a nginx problem.
I tried adding

            proxy_set_header                Host http://proxy.omnipus.ga;
            proxy_pass_request_headers      on;

but that still doesnt work

from node-unblocker.

nfriedly avatar nfriedly commented on July 1, 2024

Hum... do the logs still show express:router dispatching GET /proxy/http:/google.com +4s instead of express:router dispatching GET /proxy/http:/google.com +4s (there should be two slashes after http:)

(You can run DEBUG=express:router npm start to reduce the amount of logs coming out.)

from node-unblocker.

Porco-Rosso avatar Porco-Rosso commented on July 1, 2024

Got it!
The problem was the trailing / after the local IP
Here is the nginx config that is working, app.js needed no changes, so the problem is out of the scope of node-unblocker

server {
    listen 80;
    server_name proxy.site.com;
    keepalive_timeout 15m;
    merge_slashes off;

    location / {
            proxy_pass http://192.168.1.157:8080;
    }

    location /robots.txt {
    return 200 "User-agent: *\nDisallow: /";
    }

}

Thanks for the help!

Edit: any way to change the port? 8080 is commonly used and might overlap with other services in the future.

from node-unblocker.

nfriedly avatar nfriedly commented on July 1, 2024

Oh, doh, I missed that too! Glad its working for you now.

Thanks,
-Nathan

Sent from mobile phone.
On Nov 16, 2015 6:13 PM, "Porco-Rosso" [email protected] wrote:

Closed #55 #55.


Reply to this email directly or view it on GitHub
#55 (comment).

from node-unblocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.