BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
SEO

Authority component: The host part of a URI

The authority is the part of a URI between // and the path: optional user info, the host and an optional port. Here's how to read it and fix its errors.

Authority component: The host part of a URI
Click the image to view it full size

In a URI, the authority component names the server that holds the resource. It sits after the scheme and its two slashes, and before the path. Take this address:

https://[email protected]:8080/blog/post?ref=mail#comments

Here the authority is [email protected]:8080. The scheme is https, the path is /blog/post, the query is ref=mail and the fragment is comments. For everyday web addresses, the authority is just the hostname, so people usually call it "the domain".

The three parts

The standard for URIs, RFC 3986, writes the authority as [userinfo@]host[:port]. Only the host is required.

  • Host. A domain name such as www.example.com or an IP address such as 192.0.2.10. A domain with non-ASCII letters is written in an ASCII form called Punycode when it travels in a URL.
  • Port. The number of the "door" the server listens on, after a colon. Web addresses usually leave it out, because HTTP defaults to 80 and HTTPS to 443. A server on any other port, such as localhost:8080 during development, needs it spelled out.
  • User info. An optional name before an @. It's rare on the web, and the old user:password@ form is deprecated in the standard.

Where it starts and ends

The authority starts right after // and runs to the next /, ? or #, or to the end of the URI RFC 3986. If there are no two slashes, there is no authority.

Some schemes never have one: mailto:[email protected], tel:+1-816-555-1212 and urn: names name a thing without naming a server. File URIs often have an empty authority, which is why they show three slashes: file:///etc/hosts.

One server, several spellings

Several authorities can point to the same site, and that matters for SEO, because search engines see different URLs:

  • Case. The host is case-insensitive, so WWW.Example.com and www.example.com are the same server. Write hosts in lowercase.
  • Default ports. https://www.example.com:443/ and https://www.example.com/ are the same address. The standard says to leave out a default port.
  • With or without www. example.com and www.example.com are different hosts. They can serve different content, so search engines treat them as separate URLs.

Pick one form, redirect the others to it and use that form in links, sitemaps and canonical tags. The article on URL canonicalization covers the details.

Why user info in a URL is a risk

A password in a URL can end up in browser history, bookmarks and server logs. MDN advises against user information in HTTP URLs and points to HTTP authentication or session cookies instead.

The @ also makes a classic phishing trick work. In https://cnn.example.com&[email protected], everything before the @ is user info. The real host is 10.0.0.1 MDN. When a link looks odd, read what comes after the @: that's the host.

Fixing "URI has an authority component"

Developers meet the term most often in this Java error:

java.lang.IllegalArgumentException: URI has an authority component

It comes from new File(URI). That constructor accepts only an absolute file: URI with a path and no authority, query or fragment Java docs. A URI such as file://fileserver/projects/app has fileserver as its authority, so the constructor refuses it.

The usual cause is a project, library or config path on a network share, written as a UNC path like \\fileserver\projects\app. Tools that turn that path into a URI put the server name into the authority. Two ways out:

  1. Move the project to a local disk, or map the share to a drive letter and point the tool at that path.
  2. In your own code, check where the URI comes from and build the File from a plain local path instead of a file://server/... URI.

If the error appears during a build or deployment, search the configuration files for paths that start with \\ or file:// followed by a server name.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.