Skip to content

No possibility to modify HTTP calls in chat bubble before they are sent to serverΒ #227

@CasperJ

Description

@CasperJ

Problem

When you embed the Chat bubble into a site that is protected by a reverse proxy or API gateway, then all calls must be authenticated.
Currently, Flowise doesn't support injecting Auth headers or modifying CORS settings before sending the request to the API server.

Solution

#226 fixes this by introducing an OnRequest hook in which the request can be modified.

Example

        FlowiseAiChatBot.init({
            chatflowid: "...",
            apiHost: "/api/ai/",
            chatflowConfig: {
                // topK: 2
            },
            onRequest: async (request) => {
                const cred = await myIdentityApi.getCredentials();
                const headers = new Headers(request.headers);
                headers.append("Authorization", `Bearer ${cred.token}`);
                request.headers = headers;
            },
           ...
        });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions