UNPKG

@azure/web-pubsub

Version:
25 lines 926 B
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. Object.defineProperty(exports, "__esModule", { value: true }); exports.webPubSubReverseProxyPolicyName = void 0; exports.webPubSubReverseProxyPolicy = webPubSubReverseProxyPolicy; exports.webPubSubReverseProxyPolicyName = "webPubSubReverseProxyPolicy"; /** * Create an HTTP pipeline policy to use a reverse proxy. * This is generally going to be an Azure APIM endpoint. * @internal */ function webPubSubReverseProxyPolicy(endpoint) { const rpEndpointUrl = new URL(endpoint); return { name: exports.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