1

We have a module that has an action controller method that a third party website posts data to.

We can see that often, we can't save the data and there is an error "Request didn’t meet the user agent and IP requirement for maintaining a user session" in our web log.

I'm guessing it's this config setting "requireUserAgentAndIpForSession" but no idea how to turn that off for a specific request?

5
  • 1
    Try setting the value to 'requireUserAgentAndIpForSession' => (!isset($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] != '/your/action/contoller/function'), which would turn it off for that specific request only
    – Joshua M
    Commented Feb 1, 2021 at 16:00
  • That is what I have been mulling over, just wondered if there was anything that felt less hacky!
    – John
    Commented Feb 1, 2021 at 16:04
  • This was the official line back in 2014–craftcms.stackexchange.com/a/4554/6147. I can't see any reason why it's changed, though maybe you can set it on the controller level as public $requireUserAgentAndIpForSession = false?
    – Joshua M
    Commented Feb 1, 2021 at 16:06
  • Ah ok! I hadn't seen that one. Lovely ta!!
    – John
    Commented Feb 1, 2021 at 16:09
  • Someone want to add that as an official answer? :P
    – Brad Bell
    Commented Feb 4, 2021 at 23:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.