# Microsoft safelink is scanning and breaking onetime link

**URL:** <https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147>\
**Category:** Need Help\
**Created:** [July 22, 2024, 6:16pm UTC](https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147 "2024-07-22T18:16:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![webdeveloper](https://avatars.discourse-cdn.com/v4/letter/w/c4cdca/32.png) [@webdeveloper](https://discourse.cakephp.org/u/webdeveloper)\
**Post date:** [July 22, 2024, 6:16pm UTC](https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147/1 "2024-07-22T18:16:22Z")

</div>

Hi,

I need to differentiate between a GET request and a HEAD request in a controller action. If it’s a HEAD request, I want to skip executing the entire function; I only want to execute it for GET requests. This adjustment is necessary to accommodate Microsoft’s SafeLinks feature. How can I achieve this? Can I return TRUE in HEAD requests?

---

<div class="post-metadata">

**Author:** ![Rods](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@Rods](https://discourse.cakephp.org/u/Rods)\
**Post date:** [July 23, 2024, 2:19am UTC](https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147/2 "2024-07-23T02:19:18Z")

</div>

```
    $this->request->allowMethod(['get']);

```

if ($this-\>request-\>is([‘get’])) {  
// Do Your Logic Here  
}

---

<div class="post-metadata">

**Author:** ![webdeveloper](https://avatars.discourse-cdn.com/v4/letter/w/c4cdca/32.png) [@webdeveloper](https://discourse.cakephp.org/u/webdeveloper)\
**Post date:** [July 23, 2024, 2:00pm UTC](https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147/3 "2024-07-23T14:00:36Z")

</div>

Thank you. Can I do different logic for `get` and `head` request?  
I mean something like:

```auto
if ($this->request->is([‘get’])) {
// Do Your Logic Here
} else if ($this->request->is([‘head’])) {
return true;
}

```

---

<div class="post-metadata">

**Author:** ![webdeveloper](https://avatars.discourse-cdn.com/v4/letter/w/c4cdca/32.png) [@webdeveloper](https://discourse.cakephp.org/u/webdeveloper)\
**Post date:** [July 23, 2024, 2:02pm UTC](https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147/4 "2024-07-23T14:02:13Z")

</div>

Will this block `head` requests? `$this->request->allowMethod(['get']);`  
Because i want to allow `head` requests too, but I do not want the code to be executed when it is a `head` request

---

<div class="post-metadata">

**Author:** ![Rods](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@Rods](https://discourse.cakephp.org/u/Rods)\
**Post date:** [July 24, 2024, 1:02am UTC](https://discourse.cakephp.org/t/microsoft-safelink-is-scanning-and-breaking-onetime-link/12147/5 "2024-07-24T01:02:31Z")

</div>

Yes, You Can do like this

$this-\>request-\>allowMethod([‘get’, ‘head’]);

if ($this-\>request-\>is([‘get’])) {  
// Do Your Logic Here  
}else if ($this-\>request-\>is([‘head’])) {  
// Do Your Logic Here  
}

you can allow diffrent method as you wish
