question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't use protocol-relative URLs for external links

See original GitHub issue

This sounds confusing, so I’ll explain.

Assume someone posts a link like this: www.some.domain Lounge’s URL parser will make that clickable, turning it into <a href="//www.some.domain" (note that no protocol is given). Assuming you’re using The Lounge over HTTPS, the browser will open https://www.some.domain when you click. This is problematic because many websites still run http only, leading to The Lounge giving you dead links. Also, when someone links to a webpage without protocol, chances are they mean http and not https.

When you type www.some.tld into your browser’s URL bar, it will assume http (unless you use a plugin like HTTPS everywhere, which will fall back to http if https does not work), so I think The Lounge should do the same.

Consequently, I suggest that Lounge adds http:// to protocol-less URLs, instead of just adding //.

I am assuming that the most common cases are:

  • Server is running http only (in which case nothing listens on 443)
  • Server is running http and https (you get what you surf to)
  • Server is running http and https (you’re being redirected to https when you access http)

In each of these cases it’s safe to always link to http (when no protocol is given in the URL), whereas in one case always linking to https will lead to a browser error message, leaving the user thinking they were just given a dead link.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
astorijecommented, Jun 16, 2016

It’s pretty sad that we have to go for that direction and not the other (default to HTTPS). After all, using HTTP on all requests does have a security impact, as it leaks the request through the network! Plus there are still many websites that serve both without a redirect…

I guess using browser behavior (which may change someday soon) is the conservative choice then. Maybe when we do that we should add a note in the documentation, recommending to use something like HTTPS Everywhere to ensure maximum privacy.

2reactions
xPawcommented, Jun 16, 2016

@astorije Like it or not, but browsers default to using http as majority of the sites only work over http.

It’s up to the site maintainers to redirect to https properly, if they have it set up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The protocol-relative URL - Paul Irish
The Protocol-relative URL. Oct 27th, 2010 ... If the asset you need is available on SSL, then always use the https:// asset.
Read more >
No protocol-relative URLs | webhint documentation
If protocol-relative URLs are used for CDN links, their domain is not in the browser's HSTS preload list, and the first request is...
Read more >
Why use protocol-relative URLs at all? - Stack Overflow
Because of performance. Establishing of HTTPS connection takes much longer time than HTTP, TLS handshake adds latency delay up to ...
Read more >
Wikipedia:Protocol-relative URL
Wikipedia:Protocol-relative URL ... This is an information page. It is not one of Wikipedia's policies or guidelines, but rather intends to describe some...
Read more >
Protocol-relative URLs in email - Word to the Wise
When you link to an external resource – an image, a javascript file, ... don't really have any sensible way to use protocol-relative...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found