One server showing logged in and another server showing logged out

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 anno tempo fa
we are running our website under load balance without a sticky session.  The behavior is very strange when I am refreshing the page it is showing me logged in and after 2-3 times refresh it is showing me logged out.

So the scenario is clear at one server it is showing logged in and for another server, it is showing logged out.

I have removed all the memory cache from the customer, shopping cart, state province, and area.

As the current customer is determined by the cookie so I should show logged in to all servers. The http to https redirection is set up at the load balancer of aws. I also enable the
1. UseProxy
But do not know what value need to put for the below setting.

2. ForwardedForHeaderName
3. ForwardedProtoHeaderName
4. KnownProxies

Can anyone please help me to fix this scenario.
1 anno tempo fa
ok, I found out the issue. The cookie is browser-based but not server or instance independent because the data protection is varies depending on the instance. So I have to centalize the protection for aws. Nop already did it for the azure at the bloop storage.

 public static void AddNopDataProtection(this IServiceCollection services)
        {
            var appSettings = Singleton<AppSettings>.Instance;
            if (appSettings.Get<AzureBlobConfig>().Enabled && appSettings.Get<AzureBlobConfig>().StoreDataProtectionKeys)
            {
                var blobServiceClient = new BlobServiceClient(appSettings.Get<AzureBlobConfig>().ConnectionString);
                var blobContainerClient = blobServiceClient.GetBlobContainerClient(appSettings.Get<AzureBlobConfig>().DataProtectionKeysContainerName);
                var blobClient = blobContainerClient.GetBlobClient(NopDataProtectionDefaults.AzureDataProtectionKeyFile);

                var dataProtectionBuilder = services.AddDataProtection().PersistKeysToAzureBlobStorage(blobClient);

                if (!appSettings.Get<AzureBlobConfig>().DataProtectionKeysEncryptWithVault)
                    return;

                var keyIdentifier = appSettings.Get<AzureBlobConfig>().DataProtectionKeysVaultId;
                var credentialOptions = new DefaultAzureCredentialOptions();
                var tokenCredential = new DefaultAzureCredential(credentialOptions);

                dataProtectionBuilder.ProtectKeysWithAzureKeyVault(new Uri(keyIdentifier), tokenCredential);
            }
            else
            {

                
                services.AddDataProtection()
                .PersistKeysToAwsS3(new AmazonS3Client("AKIASOQXIF5URPA73ZHP", "p0u6T3HUc+B3sVBTIia9iyVQ8pBM4Z8lXcLt1p7w", RegionEndpoint.APSoutheast1), new S3XmlRepositoryConfig("images.mybucket.com")
                {
                    KeyPrefix = NopDataProtectionDefaults.AzureDataProtectionKeyFile,
               });

                //var dataProtectionKeysPath = CommonHelper.DefaultFileProvider.MapPath(NopDataProtectionDefaults.DataProtectionKeysPath);
                //var dataProtectionKeysFolder = new System.IO.DirectoryInfo(dataProtectionKeysPath);

                ////configure the data protection system to persist keys to the specified directory
                //services.AddDataProtection().PersistKeysToFileSystem(dataProtectionKeysFolder);
            }
        }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.