UNPKG

@azure/web-pubsub

Version:
21 lines 736 B
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. export const webPubSubReverseProxyPolicyName = "webPubSubReverseProxyPolicy"; /** * Create an HTTP pipeline policy to use a reverse proxy. * This is generally going to be an Azure APIM endpoint. * @internal */ export function webPubSubReverseProxyPolicy(endpoint) { const rpEndpointUrl = new URL(endpoint); return { name: webPubSubReverseProxyPolicyName, sendRequest(request, next) { const parsedUrl = new URL(request.url); parsedUrl.host = rpEndpointUrl.host; request.url = parsedUrl.toString(); return next(request); }, }; } //# sourceMappingURL=reverseProxyPolicy.js.map