exist webapps - get referer
Posted by gregster on 04 Oct 2011 in Activity log
Needed to know the name of the script that makes an HTTP request; assuming a referer url like http://somedomain.com/script.xql?param=value
Added a functx function:
declare function inc:substring-after-last-match
( $arg as xs:string? ,
$regex as xs:string ) as xs:string {
replace($arg,concat('^.*',$regex),'')
};
Used it like this:
let $referer := substring-before(inc:substring-after-last-match(request:get-header("referer"),'/'),'?')
Provides "script.xql" as the referer.