Forum Discussion
Deleted_User_62
Jul 07, 2015Nimbostratus
APM Webtop Links - Getting PHP to run
Using the "Hosted Content" feature of the APM, I have uploaded some PHP files that allow me to generate Secure URLs pointing to our CDN hosted downloads. However, when I created a new Webtop Link (po...
Seth_Cooper
Jul 13, 2015Employee
Hi,
Here is an iRule that should do the same thing as the php function.
You would need to create a webtop link that points to APM HOSTNAME (example https://apm.hostname.com/file1) and add it to the webtop. You will want some other checks as this would allow anybody hitting "/file1" to get to the resource. You probably will want to check for the existence of the APM session before allowing this iRule to move to the redirect part.
when HTTP_REQUEST {
if { [HTTP::uri] equals "/file1" } then {
set my_http_uri [HTTP::uri]
log local0. "HTTP_URI = $my_http_uri"
set expiry 30
set secret "SuP3rS3cR3tK3y"
set url_root "http://my.cdn.com"
set resource "/test/info.pdf"
timestamp = epoch time + expiry
set now [clock seconds]
set timestamp [expr {$now + $expiry}]
log local0. "TIMESTAMP = $timestamp"
salt = key . path ?e= timestamp
set salt "$secret$resource?e=$timestamp"
log local0. "SALT = $salt"
hash = md5(salt)
binary scan [md5 $salt] H* hash
log local0. "HASH = $hash"
url = url_root . path ?e= timestamp &h= hash
set url "$url_root$resource?e=$timestamp&h=$hash"
log local0. "URL = $url"
}
HTTP::redirect $url
}
Please let me know if this helps your solution.
Seth
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects