Introduction
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.
Screenshot
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):
curl ifconfig.io -4
Example output:
14.143.179.162
Screenshot
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:
Step 3: Access the Secure Link
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
Step 4: Testing the Secure Link
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
HTTP/2 403
date: Mon, 24 Mar 2025 08:54:03 GMT
content-type: text/html
content-length: 3083
vary: Accept-Encoding
content-security-policy: upgrade-insecure-requests
server: vergecloud
server-timing: total;dur=3
x-served-by: 7500
Screenshot
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
HTTP/2 200
date: Mon, 24 Mar 2025 08:54:28 GMT
content-type: image/png
content-length: 14759
last-modified: Mon, 24 Mar 2025 08:49:13 GMT
x-rgw-object-type: Normal
etag: "654df29e14dd9ce1058a34c617bcba3f"
x-amz-request-id: tx00000f7200ea656c73f40-0067e11dc4-b0489ea-blr1a
vary: Origin, Access-Control-Request-Headers, Access-Control-Request-Method
strict-transport-security: max-age=15552000; includeSubDomains; preload
x-xss-protection: 1; mode=block
server: vergecloud
server-timing: total;dur=12
x-cache-status: BYPASS
x-served-by: 7500
accept-ranges: bytes
Screenshot
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.
Conclusion
By following these steps, you can generate secure links for your files in Verge Cloud, ensuring they are accessible only to authorized visitors based on the hash you’ve created. Always test the link to verify that it is functioning correctly before sharing it.