GlassFish Cluster 在重定向到另一个应用程序时更改实例
GlassFish Cluster change instance when redirect to another application
在我们部署多个应用程序 之后,服务器Glassfish中的Enreprise应用程序(ear)使用集群,这个集群使用2个实例当我们导航到另一个应用程序时,我们通知集群更改实例,但我们的目标是使用相同的实例,因为我们对所有应用程序使用单点登录 (SSO)。
N.B
当我们使用一个实例和多个 Entreprise 应用程序时,一切正常。
当我们使用多个实例和一个应用程序时,一切正常
当我们使用具有多个实例的多个应用程序时,这会产生问题。
当我们使用高可用性或单点登录状态时它工作正常,但我们不不想在我们的系统中使用 HA。
对于 Apache,我们使用 Apache mod_jk 或 mod_proxy
GlassFish 3.1.2.2
Is there any solution or configuration to fix one instance per user in GlassFish or Apache, this will solve our problem?
谢谢。
您可能需要使用粘性会话,以便来自单个用户的请求始终路由到同一个 GlassFish 实例。
有关 NGinx 的配置,请查看 here(Payara Server 是 GlassFish 4 的受支持替代品)
一周后我们发现问题出在 cookie 上,所以当有人更改他的实例中的应用程序时,服务器 Apache 为每个企业应用程序创建一个新的 cookie,格式如下:
cookiesID.InstanceNBR
例如,如果我使用 3 个应用程序和 2 个实例,那么这可以创建 3 个 cookie 内容,如下所示:
cookiesModule1.Instance1
cookiesModule2.Instance2
cookiesModule3.Instance2
因为 cookie 的 path 格式对于每个应用程序都是不同的,如下所示:
/erp/module1
/erp/module2
/erp/module3
因此,为了解决这个问题,我们为 web.xml 中的所有应用程序指定了一个路径,如下所示:
<session-config>
<session-timeout>
30
</session-timeout>
<cookie-config>
<path>/PATH_OF_COOKIES</path>
</cookie-config>
</session-config>
因为我们使用 SSO 进行身份验证,所以我们只在所有应用程序的路径中使用 斜杠/:
<cookie-config>
<path>/</path>
</cookie-config>
谢谢。
在我们部署多个应用程序 之后,服务器Glassfish中的Enreprise应用程序(ear)使用集群,这个集群使用2个实例当我们导航到另一个应用程序时,我们通知集群更改实例,但我们的目标是使用相同的实例,因为我们对所有应用程序使用单点登录 (SSO)。
N.B
当我们使用一个实例和多个 Entreprise 应用程序时,一切正常。
当我们使用多个实例和一个应用程序时,一切正常
当我们使用具有多个实例的多个应用程序时,这会产生问题。
当我们使用高可用性或单点登录状态时它工作正常,但我们不不想在我们的系统中使用 HA。
对于 Apache,我们使用 Apache mod_jk 或 mod_proxy
GlassFish 3.1.2.2
Is there any solution or configuration to fix one instance per user in GlassFish or Apache, this will solve our problem?
谢谢。
您可能需要使用粘性会话,以便来自单个用户的请求始终路由到同一个 GlassFish 实例。
有关 NGinx 的配置,请查看 here(Payara Server 是 GlassFish 4 的受支持替代品)
一周后我们发现问题出在 cookie 上,所以当有人更改他的实例中的应用程序时,服务器 Apache 为每个企业应用程序创建一个新的 cookie,格式如下:
cookiesID.InstanceNBR
例如,如果我使用 3 个应用程序和 2 个实例,那么这可以创建 3 个 cookie 内容,如下所示:
cookiesModule1.Instance1
cookiesModule2.Instance2
cookiesModule3.Instance2
因为 cookie 的 path 格式对于每个应用程序都是不同的,如下所示:
/erp/module1
/erp/module2
/erp/module3
因此,为了解决这个问题,我们为 web.xml 中的所有应用程序指定了一个路径,如下所示:
<session-config>
<session-timeout>
30
</session-timeout>
<cookie-config>
<path>/PATH_OF_COOKIES</path>
</cookie-config>
</session-config>
因为我们使用 SSO 进行身份验证,所以我们只在所有应用程序的路径中使用 斜杠/:
<cookie-config>
<path>/</path>
</cookie-config>
谢谢。