Steps to Create a Secure Link

Steps to Create a Secure Link

Overview

VergeCloud allows you to generate secure links for files that are protected from unauthorized access. The process involves creating a hash based on the visitor's IP, file path, expiry timestamp, and a secret key. This document will guide you through the steps to create a secure link and use it effectively.

Step 1: Create a New Page-Rule

First, you will need to create a new page-rule. This rule can also be configured for wildcard URLs if you want to apply it to multiple paths or files.

   

 

Step 2: Generate a New Hash for the Visitor

To generate a secure link, you'll need to create a hash that includes the visitor's IP address, the file path, an expiry timestamp, and a secret key. This hash is used to verify the authenticity of the link request.
 
Information Required :
Visitor's IP Address
File Path
Expiry Timestamp
Secret Key

Example:
Visitor IP Address: 14.143.179.162
Path: /Logos-38.png
Expire timestamp: 1865746809
Key: 123456

 

Command to Get Visitor IP:
You can use the following command to get the visitor's IP address (using curl):

 

  1. curl ifconfig.io -4

 

Example output:
14.143.179.162 
 
Command to Generate the Hash:
To create the hash, use the md5sum command with the visitor's IP address, file path, expiry timestamp, and key concatenated together. Here's how you can do it:
 
echo -n "14.143.179.162 /Logos-38.png 1865746809 123456" | md5sum
 
Example output:
5e87dfa7cf51e8bd2212d0a15cfeac37  -
 
Now that you have the generated hash, you can create the secure URL to access the file. The format for the secure URL is as follows:
https://files.vergecloud.cloud/{path}?hash={generated_hash}&expires={expiry_timestamp}
 
Using the example above, the URL will look like this:
https://files.vergecloud.cloud/Logos-38.png?hash=5e87dfa7cf51e8bd2212d0a15cfeac37&expires=1865746809
 
To test the link, you can use the curl command:
 
Without the hash:
curl https://files.vergecloud.cloud/Logos-38.png -D - -o /dev/null
 
You should receive an HTTP 403 Forbidden response, indicating the link is not accessible without the correct hash.
 
Response Headers

  1. HTTP/2 403
  2. date: Mon, 24 Mar 2025 08:54:03 GMT
  3. content-type: text/html
  4. content-length: 3083
  5. vary: Accept-Encoding
  6. content-security-policy: upgrade-insecure-requests
  7. server: vergecloud
  8. server-timing: total;dur=3
  9. x-served-by: ****

 

 

 

With the hash:
curl"https://files.vergecloud.cloud/Logos-38.png?hash=58c373dfdac9d9751fd37e32e74a8fe7&expires=1743417364" -D - -o /dev/null
 
You should receive a successful HTTP 200 response and the file will be accessible.
 
 Response Headers:

  1. HTTP/2 200
  2. date: Mon, 24 Mar 2025 08:54:28 GMT
  3. content-type: image/png
  4. content-length: *****
  5. last-modified: Mon, 24 Mar 2025 08:49:13 GMT
  6. vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
  7. strict-transport-security: max-age=15552000; includeSubDomains; preload
  8. server: vergecloud
  9. server-timing: total;dur=****
  10. x-cache-status: BYPASS
  11. x-served-by: *****
  12. accept-ranges: bytes

 


A screen shot of a computer

AI-generated content may be incorrect.

 

API Reference

By following these steps, you can generate

Troubleshooting

 Common Issues:
403 Forbidden Error: This typically means that the hash or expiration timestamp is incorrect. Double-check that the generated hash matches the required parameters.
Expired Link: If the expiration timestamp has passed, the link will no longer work. Ensure that the expiration time is valid and hasn’t expired.