Problem/Motivation
There are circumstances when client IPs need to be used in an access control method. The current priority value causes ReverseProxyHeaderClientIpRestore::onRequest to run after both Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest and Drupal\Core\EventSubscriber\AuthenticationSubscriber::getSubscribedEvents
Steps to reproduce
- Create an implementation of
hook_ENTITY_TYPE_access()and set a breakpoint or diagnostic statement in the function - Set another breakpoint or diagnostic statement in
if (!$reverse_proxy_header_name)inReverseProxyHeaderClientIpRestore::onRequest
Observe that the hook_ENTITY_TYPE_access() implementation runs before this module can set the client IP.
Proposed resolution
Increase the priority of the event response so that it preceeds these other event responses. AuthenticationSubscriber runs at priority 300.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork reverse_proxy_header-3290953
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3290953-client-ip-late
changes, plain diff MR !2
Comments
Comment #3
bohartThanks for the merge request and great details on both issue description and code comments!
The only thing I am confused about is: what happened if someone/sometimes needs to put something between ReverseProxyHeaderClientIpRestore::onRequest (priority 301) and AuthenticationSubscriber::onRequest (priority 300)?
So I would like to propose to have priority like 350/400.
How do we feel about that?
Thanks!
Comment #4
fathershawnThat sounds like a fine idea
Comment #7
bohartCommitted to 1.0.x dev branch.
It will be a part of the next release (1.0.1).
Thanks!