Skip to content

Instantly share code, notes, and snippets.

@hazeledmands
Last active December 20, 2015 20:28
Show Gist options
  • Save hazeledmands/6190438 to your computer and use it in GitHub Desktop.
Save hazeledmands/6190438 to your computer and use it in GitHub Desktop.
Example of filepicker.io requests with `X-Forwarded-For` header resulting in 404.
> WORKING=yes node request.js
STATUS: 200
> WORKING=no node request.js
STATUS: 404
var http = require('http');
var working = {}
working.yes = {
hostname: 'www.filepicker.io',
port: 80,
method: 'GET',
path: '/api/file/Umgh0Q0SKejjXxAr7FVw/convert?w=110&h=100&fit=crop&align=faces&cache=true',
headers: {
"x-varnish":"2021007451",
"x-timer":"S1376006935.645165682,VS0",
"x-request-start":"1376006935759",
"x-forwarded-proto":"http",
"x-forwarded-port":"80",
"x-forwarded-host":"www.filepicker.io", // not necessary, but interesting
"x-forwarded-for":"199.27.77.21",
"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
"host":"www.filepicker.io",
"fastly-orig-host":"fbio-test.goodeggs.com",
"fastly-ff":"cache-sv61-SJC3",
"fastly-client-ip":"173.247.204.122",
"connection":"close",
"accept-language":"en-US,en;q=0.8",
"accept-encoding":"gzip",
"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
}
}
working.no = {
hostname: 'www.filepicker.io',
port: 80,
method: 'GET',
path: '/api/file/Umgh0Q0SKejjXxAr7FVw/convert?w=110&h=100&fit=crop&align=faces&cache=true',
headers: {
"x-varnish": "2010962303, 662837607",
"x-timer":"S1376005777.287178993,VS0",
"x-request-start":"1376005777405",
"x-forwarded-server":"cache-sv61.a.ssl.fastly.net",
"x-forwarded-proto":"http",
"x-forwarded-port":"80",
"x-forwarded-host":"fbio-test.goodeggs.com",
"x-forwarded-for":"173.247.204.122, 199.27.77.22",
"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
"host":"www.filepicker.io",
"fastly-ssl":"1",
"fastly-orig-host":"fbio-test.goodeggs.com",
"fastly-ff":"cache-sv61-SJC3, cache-sv62-SJC3",
"fastly-client-ip":"173.247.204.122",
"fastly-client":"1",
"connection":"close",
"accept-language":"en-US,en;q=0.8",
"accept-encoding":"gzip",
"accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
}
}
http.request(working[process.env['WORKING']], function(res) {
console.log('STATUS: ' + res.statusCode);
}).end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment