Skip to content

Commit

Permalink
Fix: xForwardBasedPath could contain query parameters
Browse files Browse the repository at this point in the history
nginx's request_uri contains query parameters. The apache construct we used previously didn't.
As this should be a path we can cut away any query parameters using a regex on the server side or in out code.
  • Loading branch information
simar0at committed Jun 3, 2024
1 parent 91bef06 commit ed7a76a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare function api:get-base-uri-public() as xs:string {
else '',
(: FIXME: this is to naive. Works for ProxyPass / to /exist/apps/cr-xq-mets/project
but probably not for /x/y/z/ to /exist/apps/cr-xq-mets/project. Especially check the get module. :)
$xForwardBasedPath := (request:header('X-Forwarded-Request-Uri'), request:path())[1]
$xForwardBasedPath := (replace(request:header('X-Forwarded-Request-Uri'), '^([^?]*)(\?.*)$', '$1'), request:path())[1]
return $urlScheme||'://'||($forwarded-hostname, request:hostname())[1]||$port||$xForwardBasedPath
};

Expand Down

0 comments on commit ed7a76a

Please sign in to comment.