All routes redirected me to /login route

M.abdallah
M.abdallah Senior backend developer Posts: 16 πŸ§‘πŸ»β€πŸš€ - Cadet
edited September 16 in Spryker Development

Following the upgrade to the latest version of the B2B demo shop in 202311, every route redirects to the login route, subsequently resulting in an ERR_TOO_MANY_REDIRECTS error. Additionally, I am unable to access any pages while in anonymous mode.

Tagged:

Answers

  • domagoj.krizanec
    domagoj.krizanec Spryker Technology Partner Posts: 9 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hello. I didn't have that exact error, but something similar where after the upgrade when I would login and after that add something to cart, I would be redirected to the homepage and I would be logged out. For me, the problem was the max-age option that was added to the HTTP request in the config file. After I removed the option, everything started to work again es expected. I'm not sure if this is the problem also on your side, but it's worth to try.

    $config[HttpConstants::YVES_HTTP_CACHE_CONTROL_CONFIG] = [ 'public' => true,
    'max-age' => 3600,];

  • M.abdallah
    M.abdallah Senior backend developer Posts: 16 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited March 17

    I think this is not my case unfortunately

    because all routes redirect to log-in automatically and at the end gives me 502 error

  • M.abdallah
    M.abdallah Senior backend developer Posts: 16 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited March 17

    The issue with CustomerPage module when registering customer page security plugins it gives me an exception regarding anonymous auth entry

    Spryker\Shared\Security\Exception\AuthenticationEntryNotRegisteredException - Authentication entry `anonymous` is not registered.

  • M.abdallah
    M.abdallah Senior backend developer Posts: 16 πŸ§‘πŸ»β€πŸš€ - Cadet

    When I register those 2 deprecated plugins

    AgentPageSecurityPlugin(),CustomerPageSecurityPlugin(),

    it gives me the above error, But If I register the new plugins it will cause too many redirects issue

    YvesAgentPageSecurityPlugin,YvesCustomerPageSecurityPlugin

  • fabrice.dhuicque
    fabrice.dhuicque Spryker Solution Partner Posts: 19 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hi @M.abdallah ,

    I can see I have today the same issue than you.

    When I upgrade my app from 202212.0 to 202307.0 (I'd rather upgrade step by step to avoid to stack issues), I had to replace the SecurityPlugins by Yves and Zed SecurityPlugins because of the same AuthenticationEntryNotRegisteredException. And since I did that, I'm stuck in a redirect loop, could you share how you have fixed that please?

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βš–οΈ - Guardians (admin)
    edited September 16

    Heyhey,

    I also came across this some time ago and I dont remember the exact solution anymore. It had sth to do with missing plugins or settings after migrating to the split-version of zed. Is this one here helpful?

    All the best,

    Florian

  • fabrice.dhuicque
    fabrice.dhuicque Spryker Solution Partner Posts: 19 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hi Florian,

    thank you for that, but we already are with the split version from the beginning of the project, I've checked the linked documentation, and everything is setup as said.

    I've had a look to the other replies, and I can't look at AccessControlEventdispatcherPlugin variables values, as xDebug doesn't want to be stop in normal mode (I can profile but not debug "normally").

    And RequestAttributesEventDispatcherPlugin is not missing.

    Thank you for your answer

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,084 βš–οΈ - Guardians (admin)

    Hmm.. sad to hear that this is still not solved :(

    At this point I dont have any further idea as it will likely be an annoying tiny small detail which causes this. Only way I found out the cause of this in another project some years ago was with deep xdebugging.

    Maybe its worth to "fix" your xdebug then?

    All the best,

    Florian

  • M.abdallah
    M.abdallah Senior backend developer Posts: 16 πŸ§‘πŸ»β€πŸš€ - Cadet

    To be honest I don't remember what the exact issue was because it was a long time ago

    But do you have
    RequestAttributesEventDispatcherPlugin under

    getEventDispatcherPlugins() && getBackofficeEventDispatcherPlugins()
    

    ?

  • fabrice.dhuicque
    fabrice.dhuicque Spryker Solution Partner Posts: 19 πŸ§‘πŸ»β€πŸš€ - Cadet

    Thank you for answers,

    @fsmeier , I'm afraid you are right about "it will likely be an annoying tiny small detail which causes this" that's often the case ^^. About my xdebug, the strange thing is that I can't activate the chrome (nor firefox) extension, it stays gray, but in my app, if I deploy in profiling mode, it works perfectly. I don't know if it's directly a xDebug issue :(

    @M.abdallah , thank you, indeed I had this plugin under getEventDispatcherPlugins but not in getBackofficeEventDispatcherPlugins, I've added it, redeploy but there is no change.

    Do you think a xdebug cachegring file could help? It's quite hard for me to see in it which method is involved into this redirects.

  • fabrice.dhuicque
    fabrice.dhuicque Spryker Solution Partner Posts: 19 πŸ§‘πŸ»β€πŸš€ - Cadet

    Hello here!

    Thanks to Spryker help, I could fix these two issues:

    • About xDebug not working in debug mode: if you can't activate the chorme extension (can occurs when you have ERR_TOO_MANY_REDIRECTS error), what you can do is to die into public/yves/index.php:
    […]
    $errorHandlerEnvironment->initialize();
    die('XXX');
    $bootstrap = new YvesBootstrap();
    $bootstrap    
      ->boot()    
      ->run();
    

    When your window dies, you can now activate xDebug, remove (or comment) your die, and then, finally debug :)

    • About the error itself, it was the '$exceptionOnNoToken' variable which was set to a wrong value because of some symfony packages in version 5 and some others in version 6. These are incompatibles of course.