Searches return everything #1946

Closed
opened 2026-02-05 02:16:59 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @jacobm001 on GitHub (Nov 18, 2020).

Describe the bug
Regardless of what is entered into any search box within bookstack, a dump of pages is returned. No search tags, quotes, or input is respected. The results are always the same, in the same order. There does not appear to be any error in my nginx logs or interface.

Steps To Reproduce
Steps to reproduce the behavior:

  1. run a search

Expected behavior
The search input to effect the search behavior in some way.

Your Configuration (please complete the following information):

  • v0.30.4
  • 7.2.18
  • Nginx
Originally created by @jacobm001 on GitHub (Nov 18, 2020). **Describe the bug** Regardless of what is entered into any search box within bookstack, a dump of pages is returned. No search tags, quotes, or input is respected. The results are always the same, in the same order. There does not appear to be any error in my nginx logs or interface. **Steps To Reproduce** Steps to reproduce the behavior: 1. run a search **Expected behavior** The search input to effect the search behavior in some way. **Your Configuration (please complete the following information):** - v0.30.4 - 7.2.18 - Nginx
Author
Owner

@ssddanbrown commented on GitHub (Nov 18, 2020):

Hi @jacobm001,
This is usually due to the query string being stripped from the URL that's actually passed to BookStack.

Are you able to provide your nginx config for BookStack?

@ssddanbrown commented on GitHub (Nov 18, 2020): Hi @jacobm001, This is usually due to the query string being stripped from the URL that's actually passed to BookStack. Are you able to provide your nginx config for BookStack?
Author
Owner

@jacobm001 commented on GitHub (Nov 18, 2020):

Yeah, my nginx config is:

server {
        index index.php index.html;

        root /var/www/BookStack/public;
        server_name {server} www.{server};

        location / {
                try_files $uri $uri/ /index.php?query_string;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.4-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/{server}/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/{server}/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}
server {
    if ($host = {server}) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = {server) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        server_name {server} www.{server};
    listen 80;
    return 404; # managed by Certbot

@jacobm001 commented on GitHub (Nov 18, 2020): Yeah, my nginx config is: ```conf server { index index.php index.html; root /var/www/BookStack/public; server_name {server} www.{server}; location / { try_files $uri $uri/ /index.php?query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/{server}/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/{server}/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = {server}) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = {server) { return 301 https://$host$request_uri; } # managed by Certbot server_name {server} www.{server}; listen 80; return 404; # managed by Certbot ```
Author
Owner

@ssddanbrown commented on GitHub (Nov 18, 2020):

Thanks @jacobm001,
I think this may be due to a missing $. I think:

try_files $uri $uri/ /index.php?query_string;

should be:

try_files $uri $uri/ /index.php?$query_string;

Can you try adding the $ before query_string as shown above and let me know if that works?

@ssddanbrown commented on GitHub (Nov 18, 2020): Thanks @jacobm001, I think this may be due to a missing `$`. I think: ``` try_files $uri $uri/ /index.php?query_string; ``` should be: ``` try_files $uri $uri/ /index.php?$query_string; ``` Can you try adding the `$` before `query_string` as shown above and let me know if that works?
Author
Owner

@jacobm001 commented on GitHub (Nov 18, 2020):

After adding the $ and reloading nginx it worked flawlessly. Thank you.

@jacobm001 commented on GitHub (Nov 18, 2020): After adding the `$` and reloading nginx it worked flawlessly. Thank you.
Author
Owner

@ssddanbrown commented on GitHub (Nov 18, 2020):

@jacobm001 Great news! Thanks for confirming that did the trick!

@ssddanbrown commented on GitHub (Nov 18, 2020): @jacobm001 Great news! Thanks for confirming that did the trick!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1946