Access Denied + Cloudflare?

Created on 7 October 2024, 3 months ago

Problem/Motivation

Webmasters have reported an increased occurrence of Access Denied / logout issues when trying to switch / unswitch using the masquerade module. I've replicated this across a handful of sites, both Drupal 7 and 10. At first I thought that it was tied to a particular hosting environment, but in more testing Cloudflare appears to be a more likely common link.

These sites have had no other code updates in the last two weeks, but early last week this started occurring. I started using Cloudflare proxy on a dev environment on a test server and the issue started happening there - it usually isn't upon the first "switch", but highly repeatable when switching back or trying to switch to another user after switching back.

I've attempted making sure that we're correctly getting the proxy IP in case that was somehow tied to it, and have tried disabling caching on the CF side (but keeping the proxy layer on).

Anyone else experiencing this?

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States matthensley Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @matthensley
  • πŸ‡¬πŸ‡§United Kingdom danthorne Devon, UK

    We are experiencing the same issue. Thanks matthensley for shedding light on the matter, would have been a long day!

  • πŸ‡¬πŸ‡·Greece dimitriskr

    Is it browser-agnostic? We have the same, but only on Chrome, Firefox works fine

  • πŸ‡§πŸ‡ͺBelgium gorkagr

    The error seems to be in Chrome, as Dimitris says.

    The error in our log looks like:

    Type: 	access denied
    
    Path: /user/{user}/masquerade?token={token}. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: 'csrf_token' URL query argument is invalid. in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 115 of /.../web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).
    
  • πŸ‡¬πŸ‡§United Kingdom rviner

    We hare experiencing this issue. It was first reported on the 4th October and thought CloudFlare could be a possible cause as no changes have been made in the last 2-3 weeks.

    It does also seem to be an issue in Chrome.

  • πŸ‡ΊπŸ‡ΈUnited States jeremyr

    Also experiencing this issue on a number of sites. Chrome + CF = Log out immediately after switching to another user. FireFox + CF = Expected result.

  • Can confirm also experiencing this issue on a site when using Chrome + CF.
    But works fine for the same site with Firefox + CF.

  • πŸ‡―πŸ‡΄Jordan Anas_maw

    Having the same issue

  • πŸ‡³πŸ‡±Netherlands wilfred waltman

    Same here.
    Other then Firefox, also Safari works as well.

  • πŸ‡ΊπŸ‡ΈUnited States jeremyr

    I did spot in the console that when you land on the masquerade switch route, /user/{user}/masquerade, the page returns a 503.

  • πŸ‡·πŸ‡ΊRussia positiff

    It's looks like in google chrome links clicked twice now.
    Noticed that in different place, but in firefox also everything fine.

  • πŸ‡ΊπŸ‡ΈUnited States jeremyr

    I observed today that masquerade is working as expected on Chrome behind CF for two different sites. Anyone else seeing that it works again?

  • πŸ‡³πŸ‡±Netherlands wilfred waltman

    @jeremyr, same here. Talk about an big WTF....

  • πŸ‡ΊπŸ‡ΈUnited States matthensley Portland, OR

    Yep, confirmed here as well. This all has to be CF changes I'd guess? It's a little unclear how often Chrome updates as they happen in background...

  • πŸ‡¬πŸ‡§United Kingdom jonathanshaw Stroud, UK

    I've seen something similar ... there was a problem and then it dissappeared.

Production build 0.71.5 2024