digest.base64url_nopad
Available inall subroutines.
Returns a Base64-encoded representation of string s
that is suitable
for use in URLs and is suitable for decoding by
digest.base64url_nopad_decode
.
For URL-safety, instances of +
are replaced with -
and instances of /
are replaced with _
.
The alphabet used is:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_
This function does not length-pad the output string.
See digest.base64_decode
for details on the structure of Base64 encoding. In particular,
note that it is possible for two input strings to encode to the same
Base64 string.
Example
declare local var.base64url_nopad_encoded STRING;set var.base64url_nopad_encoded = digest.base64url_nopad("Καλώς ορίσατε");# var.base64url_nopad_encoded is now "zprOsc67z47PgiDOv8-Bzq_Pg86xz4TOtQ"
Try it out
digest.base64url_nopad
is used in the following code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.
Click RUN on a sample below to provision a Fastly service, execute the code on Fastly, and see how the function behaves.
Base64 URL path segments
Unknown data in URL paths can result in invalid URLs, but base64url is designed to be URL-safe.