Warm tip: This article is reproduced from serverfault.com, please click

How to set SameSite attribute in Ant Media Server?

发布于 2020-12-13 14:05:53

I'm using Ant Media Server in one of my streaming project. I need to set SameSite=none in Ant Media Server. Could you please tell how to do that?

Questioner
faraway
Viewed
0
Selim Emre Toy 2020-12-13 23:05:11

You need to set the SameSite attribute through context.xml. By default, context.xml file is under /usr/local/antmedia/webapps/{APP}/META-INF/context.xml

Add the following line to set the SameSite to none:

<CookieProcessor sameSiteCookies="none" className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"/>

Then your context.xml file should something like this:

<Context>
  <Resources allowLinking="true" cacheTtl="500" className="io.antmedia.webresource.StreamWebRoot"/>
  <CookieProcessor sameSiteCookies="none" className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"/>
</Context>

Please pay attention that SameSite=none is available on accessing the secure content. In other words, you need to use HTTPS.

For other SameSite values, please visit to https://tomcat.apache.org/tomcat-8.5-doc/config/cookie-processor.html

To learn more about SameSite attribute, visit the following link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite