feat: add custom HTTP headers to each session of ollama-webui #243

Closed
opened 2025-11-11 14:13:26 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @mjtechguy on GitHub (Jan 31, 2024).

Is your feature request related to a problem? Please describe.
No problem.

Describe the solution you'd like
I would like to allow for a cookie to be passed to the ollama-webui session that my user is logged into. This would allow for me to pin each user session to a specific ollama server for an amount of time when running multiple ollama servers behind haproxy.

Describe alternatives you've considered
None of the other solutions seems feasible. They are based on IP, but all sessions of the Ollama webui come from the same IP, regardless of user.

UPDATE: See better solution for HTTP header support mentioned below.

Originally created by @mjtechguy on GitHub (Jan 31, 2024). **Is your feature request related to a problem? Please describe.** No problem. **Describe the solution you'd like** I would like to allow for a cookie to be passed to the ollama-webui session that my user is logged into. This would allow for me to pin each user session to a specific ollama server for an amount of time when running multiple ollama servers behind haproxy. **Describe alternatives you've considered** None of the other solutions seems feasible. They are based on IP, but all sessions of the Ollama webui come from the same IP, regardless of user. UPDATE: See better solution for HTTP header support mentioned below.
GiteaMirror added the enhancementgood first issuehelp wanted labels 2025-11-11 14:13:26 -06:00
Author
Owner

@justinh-rahb commented on GitHub (Jan 31, 2024):

Considering the specific communication flow between the Ollama WebUI and Ollama (via HAProxy), it appears that utilizing a cookie for session persistence might not be the optimal approach. Given that cookies are primarily a client-side mechanism designed for browser-server interactions, your scenario, which involves server-to-server communication, would be better served by leveraging custom HTTP headers sent from the backend. These headers can carry unique session IDs, enabling HAProxy to accurately route requests to the appropriate server based on session affinity, and should be ignored by Ollama normally if there's no proxy in play.

@justinh-rahb commented on GitHub (Jan 31, 2024): Considering the specific communication flow between the Ollama WebUI and Ollama (via HAProxy), it appears that utilizing a cookie for session persistence might not be the optimal approach. Given that cookies are primarily a client-side mechanism designed for browser-server interactions, your scenario, which involves server-to-server communication, would be better served by leveraging custom HTTP headers sent from the backend. These headers can carry unique session IDs, enabling HAProxy to accurately route requests to the appropriate server based on session affinity, and should be ignored by Ollama normally if there's no proxy in play.
Author
Owner

@mjtechguy commented on GitHub (Jan 31, 2024):

I stand corrected. That does seem like a much better solution. Thanks @justinh-rahb

@mjtechguy commented on GitHub (Jan 31, 2024): I stand corrected. That does seem like a much better solution. Thanks @justinh-rahb
Author
Owner

@justinh-rahb commented on GitHub (Jan 31, 2024):

Don't mention it @mjtechguy, I understood what you intended for the outcome, just helping to make sure it's articulated properly for everyone👌

@justinh-rahb commented on GitHub (Jan 31, 2024): Don't mention it @mjtechguy, I understood what you intended for the outcome, just helping to make sure it's articulated properly for everyone👌
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#243