@zazuko/trifid-handle-redirects
v0.1.3
Published
Handle redirects
Downloads
4
Readme
trifid-handle-redirects
Redirects handler for Trifid.
Usage
Install this Trifid plugin using:
npm install @zazuko/trifid-handle-redirects
Add to the trifid-configuration file
middlewares:
# […]
arbitrary-name:
module: "@zazuko/trifid-handle-redirects"
Defaults
Redirect description
This handler expects redirects to be described in the following way:
@prefix http: <http://www.w3.org/2011/http#> .
@prefix ex: <http://some/resource/> .
ex:redirect
a http:GetRequest ;
http:response [ a http:Response ;
http:responseCode http:301 ;
http:location ex:redirectedTo ; ] ;
http:requestURI ex:exampleResource .
In this example, a redirect is declared for the resource ex:exampleResource
, to the location ex:redirectedTo
.
Default query
PREFIX http: <http://www.w3.org/2011/http#>
SELECT ?location ?code WHERE {
GRAPH ?g {
?request a http:GetRequest ;
http:response [
a http:Response ;
http:responseCode ?code ;
http:location ?location
] ;
http:requestURI <CURRENT_RESOURCE>
}
} LIMIT 1