Skip to content
Discussion options

You must be logged in to vote

but I expeced to work with the original path

this seems resolve the problem

new BatchHandlerPlugin({
	mapRequestItem: (request, { request: req, prefix }) => {
		// Handle URL prefix mismatch when server is behind a reverse proxy
		// e.g., nginx rewrites /xyz/api -> /api, but batch request contains /xyz/api/...
		let url = request.url;
		const a = url.pathname;

		if (prefix && !a.startsWith(prefix)) {
			const idx = a.indexOf(prefix);
			if (idx > 0) {
				url.pathname = a.slice(idx);
			}
		}

		return {
			...request,
			url,
		};
	},
})

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@unnoq
Comment options

@wenerme
Comment options

Answer selected by unnoq
@unnoq
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants