Home
Forums
New posts
Search forums
What's new
New posts
New resources
New profile posts
Latest activity
Resources
Latest reviews
Search resources
Members
Current visitors
New profile posts
Search profile posts
DMCA Policy
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
FEEL FREE TO SHARE TUTORIALS, YOUR SKILS & KNOWLEDGE ON CODING, SCRIPTS, THEMES, PLUGINS OR ANY RESOURCES YOU HAVE WITH THE COMMUNITY-
Click Here To Post Your Request,
JOIN COMPUTER REPAIR FORUM
Home
Forums
TUTORIALS
CODING TUTORIALS
Node.js
Follow URL Redirects with Node.js
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="codeguru" data-source="post: 52" data-attributes="member: 2"><p>URL shorteners are a dime a dozen these days, and it is quite nice to have a pretty URL instead of a mile long string, but there are some downsides to URL shorteners: they can mask dangerous URLs and getting to the endpoint can be slow, since you end up making multiple requests. And <a href="https://davidwalsh.name/tinyurl-porn" target="_blank">what if a shortener sold out to a porn company</a>?! Whoa!</p><p></p><p>A while back I wrote a post about <a href="https://davidwalsh.name/curl-redirect-url" target="_blank">following URLs from command line with cURL</a>. Since I love JavaScript and Node.js is in full flight, I want to show you <a href="https://github.com/jksolbakken/linkfollower" target="_blank">[ICODE]linkfollower[/ICODE]</a>, a Node.js utility for following URL redirects and getting the final landing URL.</p><p></p><p>Start by installing [ICODE]linkfollower[/ICODE]:</p><p></p><p></p><p>yarn add linkfollower</p><p># or `npm install linkfollower`</p><p></p><p></p><p>With [ICODE]linkfollower[/ICODE] installed globally, we can use the [ICODE]follow[/ICODE] command to follow the series of redirects until the final URL:</p><p></p><p></p><p># follow {url}</p><p>follow <a href="http://davidwalsh.name/css" target="_blank">http://davidwalsh.name/css</a></p><p></p><p># RESULT:</p><p># <a href="http://davidwalsh.name/css" target="_blank">http://davidwalsh.name/css</a> -> 301</p><p># <a href="https://davidwalsh.name/css" target="_blank">https://davidwalsh.name/css</a> -> 301</p><p># <a href="https://davidwalsh.name/css-animation-callback" target="_blank">https://davidwalsh.name/css-animation-callback</a> -> 200</p><p></p><p></p><p>URL shorteners can be likened to a blindfold — the promise of going one place but possible end up in another. Using [ICODE]linkfollower[/ICODE] is a good practice if you care to be secure with links.</p><p></p><p>The post <a href="https://davidwalsh.name/follow-url-redirects-nodejs" target="_blank">Follow URL Redirects with Node.js</a> appeared first on <a href="https://davidwalsh.name" target="_blank">David Walsh Blog</a>.</p><p></p><p><a href="https://tkjs.us/dwb" target="_blank"><img src="https://davidwalsh.name/demo/tjs_block-1.svg" alt="" class="fr-fic fr-dii fr-draggable " style="" /></a></p><p></p><p><a href="https://davidwalsh.name/follow-url-redirects-nodejs" target="_blank">Continue reading...</a></p></blockquote><p></p>
[QUOTE="codeguru, post: 52, member: 2"] URL shorteners are a dime a dozen these days, and it is quite nice to have a pretty URL instead of a mile long string, but there are some downsides to URL shorteners: they can mask dangerous URLs and getting to the endpoint can be slow, since you end up making multiple requests. And [URL='https://davidwalsh.name/tinyurl-porn']what if a shortener sold out to a porn company[/URL]?! Whoa! A while back I wrote a post about [URL='https://davidwalsh.name/curl-redirect-url']following URLs from command line with cURL[/URL]. Since I love JavaScript and Node.js is in full flight, I want to show you [URL='https://github.com/jksolbakken/linkfollower'][ICODE]linkfollower[/ICODE][/URL], a Node.js utility for following URL redirects and getting the final landing URL. Start by installing [ICODE]linkfollower[/ICODE]: yarn add linkfollower # or `npm install linkfollower` With [ICODE]linkfollower[/ICODE] installed globally, we can use the [ICODE]follow[/ICODE] command to follow the series of redirects until the final URL: # follow {url} follow [URL]http://davidwalsh.name/css[/URL] # RESULT: # [URL]http://davidwalsh.name/css[/URL] -> 301 # [URL]https://davidwalsh.name/css[/URL] -> 301 # [URL]https://davidwalsh.name/css-animation-callback[/URL] -> 200 URL shorteners can be likened to a blindfold — the promise of going one place but possible end up in another. Using [ICODE]linkfollower[/ICODE] is a good practice if you care to be secure with links. The post [URL='https://davidwalsh.name/follow-url-redirects-nodejs']Follow URL Redirects with Node.js[/URL] appeared first on [URL='https://davidwalsh.name']David Walsh Blog[/URL]. [URL='https://tkjs.us/dwb'][IMG]https://davidwalsh.name/demo/tjs_block-1.svg[/IMG][/URL] [url="https://davidwalsh.name/follow-url-redirects-nodejs"]Continue reading...[/url] [/QUOTE]
Insert quotes…
Verification
Post reply
Richest Freecoded User
Most Freecoin
freecoded
4,838 Freecoin
Davy200
590 Freecoin
J
Johnhendrick
575 Freecoin
S
Smith16
527 Freecoin
nathan69
426 Freecoin
Laureine
415 Freecoin
A
anajeen
370 Freecoin
C
codeguru
287 Freecoin
Tekera
267 Freecoin
A
Akubay
170 Freecoin
Home
Forums
TUTORIALS
CODING TUTORIALS
Node.js
Follow URL Redirects with Node.js
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top