<p>We have a module that has an action controller method that a third party website posts data to.</p>
<p>We can see that often, we can't save the data and there is an error &quot;<code>Request didn’t meet the user agent and IP requirement for maintaining a user session</code>&quot; in our web log.</p>
<p>I'm guessing it's this config setting &quot;<code>requireUserAgentAndIpForSession</code>&quot; but no idea how to turn that off for a specific request?</p>

CC BY-SA 4.0
2021-02-01T16:00:51.463Z
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
CC BY-SA 4.0
2021-02-01T16:04:34.287Z
That is what I have been mulling over, just wondered if there was anything that felt less hacky!
John
CC BY-SA 4.0
2021-02-01T16:06:18.473Z
This was the official line back in 2014–https://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
CC BY-SA 4.0
2021-02-01T16:09:06.540Z
Ah ok! I hadn't seen that one. Lovely ta!!
John
CC BY-SA 4.0
2021-02-04T23:28:57.070Z
Someone want to add that as an official answer? :P
Brad Bell
<controller><modules>
Request didn’t meet the user agent and IP requirement for maintaining a user session when website posts to our action URL
# Request didn’t meet the user agent and IP requirement for maintaining a user session when website posts to our action URL

(Asked by: username_0 on 2021-02-01)

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?

**Tags:** controller, modules
> **Comments:**
> **username_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  
> **username_0**: That is what I have been mulling over, just wondered if there was anything that felt less hacky!  
> **username_1**: This was the official line back in 2014–https://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`?  
> **username_0**: Ah ok! I hadn't seen that one. Lovely ta!!  
> **username_2**: Someone want to add that as an official answer? :P  

---

## 0 answers

