# Hooks from: & to: syntax in yml to disable anonymous searches

**URL:** https://meta.discourse.org/t/hooks-from-to-syntax-in-yml-to-disable-anonymous-searches/370952
**Category:** Support
**Created:** [June 19, 2025, 9:19pm UTC](https://meta.discourse.org/t/hooks-from-to-syntax-in-yml-to-disable-anonymous-searches/370952 "2025-06-19T21:19:09Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![opcourdis](https://avatars.discourse-cdn.com/v4/letter/o/45deac/32.png) [@opcourdis](https://meta.discourse.org/u/opcourdis)
#### Post date: [June 21, 2025, 9:57am UTC](https://meta.discourse.org/t/hooks-from-to-syntax-in-yml-to-disable-anonymous-searches/370952/4 "2025-06-21T09:57:21Z")

</div>

Thanks for providing with the variable, with this [documentation](https://meta.discourse.org/t/using-hidden-site-settings/308773) I could make it work.

So I modified the app.yml with the following, saved, then ./launcher restart app(no rebuild needed)

```plaintext
env:
  DISCOURSE_RATE_LIMIT_SEARCH_ANON_GLOBAL_PER_MINUTE: 0

```

Now the /search page is unreachable = great  
Now the front end search button instantly returns : you’ve performed this action too many times = great  
You may hide the search button with :

```plaintext
.anon #search-button {
	display: none !important;
}

```

But the question is : is this thorough? Can anyone just create a simple session cookie to make it look like they are connected so that they can access the content of the site through searches?

More thorough but uncomplete solution :

The file is : /var/www/discourse/app/controllers/search\_controller.rb  
The modification : add “if current\_user.present?” after “def show” and add an “end” at the bottom of the condition.

However I could not make it persistent after restart, so anybody is welcome to tell how to make it persistent after restart with the app.yml hooks after\_code replace: feature.

---

_[View the full topic](https://meta.discourse.org/t/hooks-from-to-syntax-in-yml-to-disable-anonymous-searches/370952)._
