Whats the difference between a scheme and a protocol in a URL?

Jonathan002 picture Jonathan002 · Feb 23, 2018 · Viewed 7.6k times · Source

I'm hoping someone can clarify to me the technical difference between a protocol and a scheme in a url. (or identify the rest of the items that can also be placed in a scheme?)

Originally I had thought they were the same and that scheme was just another name for it.

You can find scheme referenced here in this wikipedia article.

Although according to an answer here a scheme is not considered to be a protocol because:

there is no transport layer or encoding

Is this the proper way that defines their difference or is there more to it that makes the two different?

How can I distinctly tell when I'm dealing with a protocol or scheme? (or something other than a protocol that also qualifies to be used in a scheme? since it seems that protocols get placed in the scheme part of a url)

Answer

clayjones94 picture clayjones94 · Feb 23, 2018

My understanding is that the two terms have a significant overlap. The protocol being the agreed upon method of information transfer and the scheme being the identifier that URLs use to express what type of protocol the specific resource should be served over. In short, schemes are simply identifiers for protocols.

For example

In the link https://example.com, http is the scheme that tells the browser (or whoever the requester of that resource is) that the resource at example.com will be served over the Hypertext Transfer Protocol (HTTP), which is the type of "protocol".

Scheme <> Protocol

ftp <> File Transer protocol
http <> Hypertext Transfer Protocol