question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to specify cookie Path so that AI works behind App Gateway

See original GitHub issue

Currently 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:

  1. 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.
  2. Set cookie path to “”, the behavior is identical to #1
  3. 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:

  1. 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
  2. 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.
  3. 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:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
01binarycommented, Feb 4, 2021

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

0reactions
github-actions[bot]commented, Mar 30, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found