All Projects → follow-redirects → Follow Redirects

follow-redirects / Follow Redirects

Licence: mit
Node.js module that automatically follows HTTP(S) redirects

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Follow Redirects

extract-tls-secrets
Decrypt HTTPS/TLS connections on the fly with Wireshark
Stars: ✭ 226 (-28.93%)
Mutual labels:  https
Gsyvideoplayer
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
Stars: ✭ 16,948 (+5229.56%)
Mutual labels:  https
Jetty.project
Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
Stars: ✭ 3,260 (+925.16%)
Mutual labels:  https
electron-request
Zero-dependency, Lightweight HTTP request client for Electron or Node.js
Stars: ✭ 45 (-85.85%)
Mutual labels:  https
Http
Host These Things Please - a basic http server for hosting a folder fast and simply
Stars: ✭ 275 (-13.52%)
Mutual labels:  https
Acme Client Quick
get let's encrypt cert in five minutes
Stars: ✭ 295 (-7.23%)
Mutual labels:  https
http-simple-cheatsheet
Simple HTTP status codes cheatsheet 🦄
Stars: ✭ 18 (-94.34%)
Mutual labels:  https
Ofbiz Framework
Apache OFBiz is an open source product for the automation of enterprise processes. It includes framework components and business applications for ERP, CRM, E-Business/E-Commerce, Supply Chain Management and Manufacturing Resource Planning. OFBiz provides a foundation and starting point for reliable, secure and scalable enterprise solutions.
Stars: ✭ 315 (-0.94%)
Mutual labels:  https
Crypt Le
Crypt::LE - Let's Encrypt / Buypass / ACME client and library in Perl for obtaining free SSL certificates (inc. generating RSA/ECC keys and CSRs). HTTP/DNS verification is supported out of the box, easily extended with plugins, easily dockerized.
Stars: ✭ 277 (-12.89%)
Mutual labels:  https
Microwebsrv2
The last Micro Web Server for IoTs (MicroPython) or large servers (CPython), that supports WebSockets, routes, template engine and with really optimized architecture (mem allocations, async I/Os). Ready for ESP32, STM32 on Pyboard, Pycom's chipsets (WiPy, LoPy, ...). Robust, efficient and documented!
Stars: ✭ 295 (-7.23%)
Mutual labels:  https
Prdownloader
PRDownloader - A file downloader library for Android with pause and resume support
Stars: ✭ 2,947 (+826.73%)
Mutual labels:  https
Auth Boss
🔒 Become an Auth Boss. Learn about different authentication methodologies on the web.
Stars: ✭ 2,879 (+805.35%)
Mutual labels:  https
Ace
HTTP web server and client, supports http1 and http2
Stars: ✭ 295 (-7.23%)
Mutual labels:  https
LightTunnel
LightTunnel-内网穿透映射工具,支持TCP、HTTP、HTTPS穿透映射,支持Windows、Linux、Mac、Android系统
Stars: ✭ 40 (-87.42%)
Mutual labels:  https
Https Everywhere
A browser extension that encrypts your communications with many websites that offer HTTPS but still allow unencrypted connections.
Stars: ✭ 3,262 (+925.79%)
Mutual labels:  https
netplus
An easy-to-learn, high performance network io library written in modern cpp (c++11), It borrows concepts from Netty, and with well defined internal modules, It enables you to write rpc, http/https,websocket application with just few lines。
Stars: ✭ 43 (-86.48%)
Mutual labels:  https
Nps
一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
Stars: ✭ 19,537 (+6043.71%)
Mutual labels:  https
Kurly
kurly is an alternative to the widely popular curl program, written in Golang.
Stars: ✭ 319 (+0.31%)
Mutual labels:  https
Libuhttpd
A very flexible, lightweight and fully asynchronous HTTP server library based on libev and http-parser for Embedded Linux.
Stars: ✭ 302 (-5.03%)
Mutual labels:  https
Netty Http Client
An asynchronous http client in Java, with a clean, callback-based API, using Netty 4.x
Stars: ✭ 295 (-7.23%)
Mutual labels:  https

Follow Redirects

Drop-in replacement for Node's http and https modules that automatically follows redirects.

npm version Build Status Coverage Status npm downloads Sponsor on GitHub

follow-redirects provides request and get methods that behave identically to those found on the native http and https modules, with the exception that they will seamlessly follow redirects.

const { http, https } = require('follow-redirects');

http.get('http://bit.ly/900913', response => {
  response.on('data', chunk => {
    console.log(chunk);
  });
}).on('error', err => {
  console.error(err);
});

You can inspect the final redirected URL through the responseUrl property on the response. If no redirection happened, responseUrl is the original request URL.

const request = https.request({
  host: 'bitly.com',
  path: '/UHfDGO',
}, response => {
  console.log(response.responseUrl);
  // 'http://duckduckgo.com/robots.txt'
});
request.end();

Options

Global options

Global options are set directly on the follow-redirects module:

const followRedirects = require('follow-redirects');
followRedirects.maxRedirects = 10;
followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB

The following global options are supported:

  • maxRedirects (default: 21) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.

  • maxBodyLength (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.

Per-request options

Per-request options are set by passing an options object:

const url = require('url');
const { http, https } = require('follow-redirects');

const options = url.parse('http://bit.ly/900913');
options.maxRedirects = 10;
options.beforeRedirect = (options, { headers }) => {
  // Use this to adjust the request options upon redirecting,
  // to inspect the latest response headers,
  // or to cancel the request by throwing an error
  if (options.hostname === "example.com") {
    options.auth = "user:password";
  }
};
http.request(options);

In addition to the standard HTTP and HTTPS options, the following per-request options are supported:

  • followRedirects (default: true) – whether redirects should be followed.

  • maxRedirects (default: 21) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.

  • maxBodyLength (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.

  • beforeRedirect (default: undefined) – optionally change the request options on redirects, or abort the request by throwing an error.

  • agents (default: undefined) – sets the agent option per protocol, since HTTP and HTTPS use different agents. Example value: { http: new http.Agent(), https: new https.Agent() }

  • trackRedirects (default: false) – whether to store the redirected response details into the redirects array on the response object.

Advanced usage

By default, follow-redirects will use the Node.js default implementations of http and https. To enable features such as caching and/or intermediate request tracking, you might instead want to wrap follow-redirects around custom protocol implementations:

const { http, https } = require('follow-redirects').wrap({
  http: require('your-custom-http'),
  https: require('your-custom-https'),
});

Such custom protocols only need an implementation of the request method.

Browser Usage

Due to the way the browser works, the http and https browser equivalents perform redirects by default.

By requiring follow-redirects this way:

const http = require('follow-redirects/http');
const https = require('follow-redirects/https');

you can easily tell webpack and friends to replace follow-redirect by the built-in versions:

{
  "follow-redirects/http"  : "http",
  "follow-redirects/https" : "https"
}

Contributing

Pull Requests are always welcome. Please file an issue detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied by tests. You can run the test suite locally with a simple npm test command.

Debug Logging

follow-redirects uses the excellent debug for logging. To turn on logging set the environment variable DEBUG=follow-redirects for debug output from just this module. When running the test suite it is sometimes advantageous to set DEBUG=* to see output from the express server as well.

Authors

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].