Hello this is the behavior I'm getting:

Drupal 8.6
Enable the module
Set up pages, cookie name, etc in settings.

Navigate to "source" page
Redirected to "splash" page
Check cookies, cookie is set and value is true
Navigate to "source" page
Redirect still occurs to "splash" page

Expected behavior:
After cookie is set and value is true
Navigate to "source" page
No redirect occurs.

Comments

krisrobinson created an issue. See original summary.

krisrobinson’s picture

Additionally, the cookie is set on FireFox and Safari but for some reason not on Chrome. Although regardless if it is set or not, redirect occurs.

The cookie is set in all browsers, but the page still redirects to the "splash" from the "source". I have disabled Internal Page Cache module from core as well. I have left the Internal Page Dynamic Cache module. I am not sure the requirements.

adambernstein’s picture

Assigned: Unassigned » adambernstein

Thank you for these bug reports. I haven't tested this module on 8.6 yet, so I'll take a look sometime this week and debug.

krisrobinson’s picture

@AdamBernstein I'm doing some more testing today as well and will report back. Thanks for the reply.

krisrobinson’s picture

To me it doesn't appear that this statement is ever evaluated correctly, ie. it never returns false, it always thinks there is no cookie even when it has been set.

 if (!$request->cookies->get($config_cookie)) {
 }
krisrobinson’s picture

Link of interest: Reading cookies through request, not response on Drupal Answers

Maybe I just don't know what I'm talking about but the problem seems to be that the module is not reading the existing cookie that is set, this link suggest you need to read the cookie through Request instead of the empty Response object.

krisrobinson’s picture

I started this question on Drupal Answers:

https://drupal.stackexchange.com/questions/274485/cant-find-cookie-for-v...

Nothing definitive. All I can say is that the headers return that the cookie is not set because it's not set in the request headers, although it is in the browser cookies. I walked around in circles on it, I can always successfully forward the user and set the cookie in the browser, but can never successfully check if the browser cookie already exists.

adambernstein’s picture

Thanks Kris. Unfortunately I'm not able to replicate your issue, even on a clean install of Drupal 8.6.4, so am having trouble pinpointing where things might be going wrong.

Can you provide more details about your specific environment? Where are you hosting your Drupal site? Are you using a CDN? Are there other caching modules you've enabled besides Drupal Internal Dynamic Page Caches? What are the specific values you input in the Splash Redirect settings page? And you're sure you're using version 8.x-1.1-beta3?

krisrobinson’s picture

@AdamBernstein I'll do some tests on a clean install. The only thing I'm thinking that I have installed that could mess it up is the Redirect (https://drupal.org/project/redirect) module. I'll report back shortly.

krisrobinson’s picture

@AdamBernstein --

Fresh install still has the same issue.

Install Drupal
Enable splash_redirect
disable internal page cache

Environment:
- Local: Lando development environment with Pantheon recipe.
- Remote: Pantheon.io dev site

Settings page:
Screenshot

Splash page: (node/2) is persistent despite the cookie being set in the browser storage as seen in dev tools (clicking links to node/1 will ALWAYS send you to node/2 despite the cookie being set in the browser dev tools):

Screenshot 2

krisrobinson’s picture

I think this has something to do with my environment or something, based on this:

working subscriber on Drupal answers

I installed this code and it was doing the same thing as yours, while the developer who posted it has it working on 2 separate machines.

adambernstein’s picture

Okay I think I got it. This is unique to Pantheon's Global CDN.

Pantheon passes all cookies beginning with SESS that are followed by numbers and lowercase characters back to the application. When at least one of these cookies is present, the Global CDN will not try to respond to the request from its cache or store the response.

For now, please prefix your Splash cookie name with the word "SESS" (e.g. `SESSsplash`) to bypass the CDN headers.

I will update the documentation to make sure that Pantheon customers know this, and will continue to look at workarounds for that environment. Thanks again for pointing this out and submitting the bug ticket.

krisrobinson’s picture

Confirmed! Hooray.

Also, had to make sure the cookie had no underscores, SESScookiename works, SESScookie_name does not.

Wow, thank you for diagnosing this, appreciate it. I think @4k4 on Drupal Answers also had some nice additional code to your module with his pared down version.

adambernstein’s picture

Status: Active » Reviewed & tested by the community

So glad it worked for you. And thank you for bringing it to my attention, I'll be able to refactor some of the code based on @4k4's suggestions in the Stackexchange thread. Works out for everyone!

adambernstein’s picture

Status: Reviewed & tested by the community » Needs work
adambernstein’s picture

Status: Needs work » Closed (outdated)