Ability to specify cookie Path so that AI works behind App Gateway
See original GitHub issueCurrently when creating cookies, the cookie path is hard-coded to /
. This breaks cookies when an application using AI Client SDK is placed behind a reverse proxy such as App Gateway product in Azure. Applications behind the reverse proxy are available on sub-paths like /app1, /app2, and so on. Because AI cookies have path as /, they are shared between all apps. This results in the app that was refreshed last overwriting the session cookie for all other apps. That means AI session for the app that gets requested from server the most ends up with all the AI logs, and all other apps have their sessions deleted.
Possible solutions:
- Do not set cookie path at all, browser will choose the current path to be the default. If AI SDK is initialized by /app1, cookie path will be set to /app1 by the browser, then app1 will track all of its AI cookies without other apps seeing and overwriting them.
- Set cookie path to “”, the behavior is identical to #1
- Let cookie path be configurable for all cookies. You already have a setting for cookie domain, so you would just need to add one more setting for cookie path
Alternatives I considered:
- Create our own fork of AI Client SDK and maintain it separately. We can choose to make #1, #2, or #3 change there and push it to our package server, then have everyone in the company use that. Obviously there are some maintenance effort issues with that
- Implement #3 for this repo and submit it as a pull request. It could add a setting for cookie path and have it be ‘/’ by default for backward compatibility. If set to null, cookie path will not be set (#1). That way the solution is both backward compatible and simple.
- Write additional code and package it for our applications, that will initialize AI SDK with cookies disabled, and then create our own cookies. That has maintenance effort issues just like alternative #1 even though we avoid modifying AI Client SDK.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Azure Application Gateway HTTP settings configuration
This article describes how to configure Azure Application Gateway HTTP settings.
Read more >Azure Application Gateway (Layer 7 Load Balancer) - Navisite
Step #2. HTTP Setting defines cookie-based session affinity to route the traffic to a particular backend server. This also defines the port on...
Read more >mod_proxy - Apache HTTP Server Version 2.4
mod_proxy and related modules implement a proxy/gateway for Apache HTTP Server, supporting a number of popular protocols as well as several different load ......
Read more >Azure Load Balancer | Azure Front Door vs Application Gateway
Public load balancer used for balancing the internet traffic to virtual machines. it provides an outbound connection to virtual machines.
Read more >Set up a global external HTTP(S) load balancer (classic) with ...
Deploy an App Engine, Cloud Functions, or Cloud Run service. If you haven't already done so, install the Google Cloud CLI. Configure permissions....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I know this stuff takes a really long time, I didn’t mean that I’m trying to rush anything, just that I didn’t forget & appreciate the effort
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.