Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a UUID "URL safe"?

Tags:

url

uuid

Is a UUID URL safe? I want to use it as an alternate ID yet perhaps allowing access to the record as the ID in the URL. While I can use Ruby’s SecureRandom.urlsafe_base64(27) to obtain a random base64-encoded string of the same length, a UUID looks cleaner.

like image 642
user1322092 Avatar asked Apr 18 '14 01:04

user1322092


1 Answers

Yes.

  • A UUID consists of only hexadecimal characters (a–f, 0–9) plus a hyphen (-).

  • As per RFC 3986 (URI Syntax) §2.3, hyphen and hexadecimal characters are included in those explicitly unreserved:

    Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period, underscore, and tilde.

like image 172
Andrew Marshall Avatar answered Sep 28 '22 06:09

Andrew Marshall