File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -107,11 +107,20 @@ function serveErrorResponse(error: Error) {
107
107
}
108
108
109
109
/**
110
- * The URL of the GitBook content can be passed in 2 different ways:
110
+ * The URL of the GitBook content can be passed in 3 different ways:
111
+ * - The request URL is in the `X-GitBook-URL` header.
111
112
* - Hostname is in the `X-GitBook-Host` header and the pathname is the path in the request URL.
112
113
* - The request URL is matching `/url/:url`
113
114
*/
114
115
function extractURL ( request : NextRequest ) : URLWithMode | null {
116
+ const xGitbookUrl = request . headers . get ( 'x-gitbook-url' ) ;
117
+ if ( xGitbookUrl ) {
118
+ return {
119
+ url : new URL ( xGitbookUrl ) ,
120
+ mode : 'url-host' ,
121
+ } ;
122
+ }
123
+
115
124
const xGitbookHost = request . headers . get ( 'x-gitbook-host' ) ;
116
125
if ( xGitbookHost ) {
117
126
return {
You can’t perform that action at this time.
0 commit comments