Bookstack frontend is redirected to old domain name after updated URL #4624

Closed
opened 2026-02-05 09:08:13 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @diasdmhub on GitHub (Apr 13, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I've updated my local domain name and now, when I try to access Bookstack frontend, it redirects me to the old domain name.

  • Old name: bookstack.old
  • New name: bookstack.new

The host is set to the new name.

$ hostname -f
bookstack.new

The Apache config is already set to the new name.

/etc/apache2/sites-available/bookstack.conf

<VirtualHost *:80>
  ServerName bookstack.new
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/bookstack/public/
  <Directory /var/www/bookstack/public/>
      Options -Indexes +FollowSymLinks
      AllowOverride None
      Require all granted
      <IfModule mod_rewrite.c>
          <IfModule mod_negotiation.c>
              Options -MultiViews -Indexes
          </IfModule>

          RewriteEngine On

          # Handle Authorization Header
          RewriteCond %{HTTP:Authorization} .
          RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

          # Redirect Trailing Slashes If Not A Folder...
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_URI} (.+)/$
          RewriteRule ^ %1 [L,R=301]

          # Handle Front Controller...
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^ index.php [L]
      </IfModule>
  </Directory>
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Bookstack seems to be up to date.

From https://github.com/BookStackApp/BookStack
 * branch              release    -> FETCH_HEAD
Already up to date.
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
> @php -r "!file_exists('bootstrap/cache/services.php') || @unlink('bootstrap/cache/services.php');"
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.

  barryvdh/laravel-dompdf ..................................................................................................................... DONE
  barryvdh/laravel-snappy ..................................................................................................................... DONE
  intervention/image .......................................................................................................................... DONE
  laravel/socialite ........................................................................................................................... DONE
  laravel/tinker .............................................................................................................................. DONE
  nesbot/carbon ............................................................................................................................... DONE
  nunomaduro/termwind ......................................................................................................................... DONE
  socialiteproviders/manager .................................................................................................................. DONE

63 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan cache:clear

   INFO  Application cache cleared successfully.

> @php artisan view:clear

   INFO  Compiled views cleared successfully.

                                                                                                   APPLICATION IN PRODUCTION.

  Do you really wish to run this command? (yes/no) [no]
yes

   INFO  Nothing to migrate.

   INFO  Application cache cleared successfully.

   INFO  Configuration cache cleared successfully.

   INFO  Compiled views cleared successfully.

I've also tried to update the URL path.

@bookstack:/var/www/bookstack$ php artisan bookstack:update-url http://bookstack.old http://bookstack.new

 This will search for "http://bookstack.old" in your database and replace it with  "http://bookstack.new".
Are you sure you want to proceed? (yes/no) [no]:
 > yes

 This operation could cause issues if used incorrectly. Have you made a backup of your existing database? (yes/no) [no]:
 > yes

Updated 0 rows in attachments->path
Updated 10 rows in pages->html
Updated 0 rows in pages->text
Updated 0 rows in pages->markdown
Updated 0 rows in chapters->description_html
Updated 0 rows in books->description_html
Updated 0 rows in bookshelves->description_html
Updated 39 rows in images->url
Updated 0 rows in settings->value
Updated 0 rows in comments->html
Updated 0 rows in comments->text
Updated 0 JSON encoded rows in settings->value
URL update procedure complete.
============================================================================
Be sure to run "php artisan cache:clear" to clear any old URLs in the cache.
============================================================================
@bookstack:/var/www/bookstack$ php artisan cache:clear
   INFO  Application cache cleared successfully.

However, when I try to access its frontend, it keeps redirecting me to the old domain name.

$ curl http://127.0.0.1
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url='http://bookstack.old/login'" />

        <title>Redirecting to http://bookstack.old/login</title>
    </head>
    <body>
        Redirecting to <a href="http://bookstack.old/login">http://bookstack.old/login</a>.
    </body>
</html>

/var/log/apache2/access.log

127.0.0.1 - - [13/Apr/2024:11:43:18 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/7.81.0"

With all this, I'm unable to access Bookstack.
Only if I add an entry to my DNS for the old domain name can I access it.

I just can't see what the problem is. Any thoughts on this matter?
Thanks.

Exact BookStack Version

24

Log Content

I could not find any errors on Apache logs, nor Lavarel logs.

# After restarts
@bookstack:~$ tail /var/www/bookstack/storage/logs/laravel.log
#13 /var/www/bookstack/app/Exceptions/Handler.php(66): Illuminate\\Foundation\\Exceptions\\Handler->render()
#14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(233): BookStack\\Exceptions\\Handler->render()
#15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(210): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse()
#16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException()
#17 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#18 {main}
  thrown at /var/www/bookstack/storage/framework/views/58966642253d57ffe4f154d44ae65835f6011243.php:68)
[stacktrace]
#0 {main}
"}
# Apache restarts only
@bookstack:~$ sudo tail /var/log/apache2/error.log
[Sat Apr 13 12:13:14.155953 2024] [mpm_prefork:notice] [pid 477] AH00170: caught SIGWINCH, shutting down gracefully
[Sat Apr 13 12:13:14.217377 2024] [mpm_prefork:notice] [pid 751] AH00163: Apache/2.4.52 (Ubuntu) OpenSSL/3.0.2 configured -- resuming normal operations
[Sat Apr 13 12:13:14.217403 2024] [core:notice] [pid 751] AH00094: Command line: '/usr/sbin/apache2'
# Redirects only
@bookstack:~$ sudo tail /var/log/apache2/access.log
192.168.7.212 - - [13/Apr/2024:11:58:37 -0300] "GET / HTTP/1.1" 302 1961 "-" "axios/1.6.7"
192.168.7.3 - - [13/Apr/2024:11:58:41 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
192.168.7.3 - - [13/Apr/2024:11:58:54 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
192.168.7.3 - - [13/Apr/2024:11:58:59 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/8.0.1"
192.168.7.212 - - [13/Apr/2024:12:03:52 -0300] "GET / HTTP/1.1" 302 1961 "-" "axios/1.6.7"
192.168.7.3 - - [13/Apr/2024:12:03:55 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
127.0.0.1 - - [13/Apr/2024:12:04:02 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/7.81.0"
192.168.7.3 - - [13/Apr/2024:12:07:24 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
192.168.7.3 - - [13/Apr/2024:12:13:19 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
192.168.7.3 - - [13/Apr/2024:12:13:30 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/8.0.1" 

Hosting Environment

  • Ubuntu 22.04
  • MySQL 8.0.36
  • Apache/2.4.52
  • PHP 8.1.2
Originally created by @diasdmhub on GitHub (Apr 13, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario ### I've updated my local domain name and now, when I try to access Bookstack frontend, it redirects me to the old domain name. - **Old** name: `bookstack.old` - **New** name: `bookstack.new` <BR> ### The host is set to the new name. ``` $ hostname -f bookstack.new ``` ### The Apache config is already set to the new name. `/etc/apache2/sites-available/bookstack.conf` ``` <VirtualHost *:80> ServerName bookstack.new ServerAdmin webmaster@localhost DocumentRoot /var/www/bookstack/public/ <Directory /var/www/bookstack/public/> Options -Indexes +FollowSymLinks AllowOverride None Require all granted <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ``` ### Bookstack seems to be up to date. ``` From https://github.com/BookStackApp/BookStack * branch release -> FETCH_HEAD Already up to date. Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]? yes > @php -r "!file_exists('bootstrap/cache/services.php') || @unlink('bootstrap/cache/services.php');" Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi INFO Discovering packages. barryvdh/laravel-dompdf ..................................................................................................................... DONE barryvdh/laravel-snappy ..................................................................................................................... DONE intervention/image .......................................................................................................................... DONE laravel/socialite ........................................................................................................................... DONE laravel/tinker .............................................................................................................................. DONE nesbot/carbon ............................................................................................................................... DONE nunomaduro/termwind ......................................................................................................................... DONE socialiteproviders/manager .................................................................................................................. DONE 63 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan cache:clear INFO Application cache cleared successfully. > @php artisan view:clear INFO Compiled views cleared successfully. APPLICATION IN PRODUCTION. Do you really wish to run this command? (yes/no) [no] yes INFO Nothing to migrate. INFO Application cache cleared successfully. INFO Configuration cache cleared successfully. INFO Compiled views cleared successfully. ``` ### I've also tried to update the URL path. ``` @bookstack:/var/www/bookstack$ php artisan bookstack:update-url http://bookstack.old http://bookstack.new This will search for "http://bookstack.old" in your database and replace it with "http://bookstack.new". Are you sure you want to proceed? (yes/no) [no]: > yes This operation could cause issues if used incorrectly. Have you made a backup of your existing database? (yes/no) [no]: > yes Updated 0 rows in attachments->path Updated 10 rows in pages->html Updated 0 rows in pages->text Updated 0 rows in pages->markdown Updated 0 rows in chapters->description_html Updated 0 rows in books->description_html Updated 0 rows in bookshelves->description_html Updated 39 rows in images->url Updated 0 rows in settings->value Updated 0 rows in comments->html Updated 0 rows in comments->text Updated 0 JSON encoded rows in settings->value URL update procedure complete. ============================================================================ Be sure to run "php artisan cache:clear" to clear any old URLs in the cache. ============================================================================ ``` ``` @bookstack:/var/www/bookstack$ php artisan cache:clear INFO Application cache cleared successfully. ``` ### However, when I try to access its frontend, it keeps redirecting me to the old domain name. ``` $ curl http://127.0.0.1 <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta http-equiv="refresh" content="0;url='http://bookstack.old/login'" /> <title>Redirecting to http://bookstack.old/login</title> </head> <body> Redirecting to <a href="http://bookstack.old/login">http://bookstack.old/login</a>. </body> </html> ``` `/var/log/apache2/access.log` ``` 127.0.0.1 - - [13/Apr/2024:11:43:18 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/7.81.0" ``` With all this, I'm unable to access Bookstack. Only if I add an entry to my DNS for the old domain name can I access it. I just can't see what the problem is. Any thoughts on this matter? Thanks. ### Exact BookStack Version 24 ### Log Content I could not find any errors on Apache logs, nor Lavarel logs. ``` # After restarts @bookstack:~$ tail /var/www/bookstack/storage/logs/laravel.log #13 /var/www/bookstack/app/Exceptions/Handler.php(66): Illuminate\\Foundation\\Exceptions\\Handler->render() #14 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(233): BookStack\\Exceptions\\Handler->render() #15 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(210): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->renderHttpResponse() #16 /var/www/bookstack/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleException() #17 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}() #18 {main} thrown at /var/www/bookstack/storage/framework/views/58966642253d57ffe4f154d44ae65835f6011243.php:68) [stacktrace] #0 {main} "} ``` ``` # Apache restarts only @bookstack:~$ sudo tail /var/log/apache2/error.log [Sat Apr 13 12:13:14.155953 2024] [mpm_prefork:notice] [pid 477] AH00170: caught SIGWINCH, shutting down gracefully [Sat Apr 13 12:13:14.217377 2024] [mpm_prefork:notice] [pid 751] AH00163: Apache/2.4.52 (Ubuntu) OpenSSL/3.0.2 configured -- resuming normal operations [Sat Apr 13 12:13:14.217403 2024] [core:notice] [pid 751] AH00094: Command line: '/usr/sbin/apache2' ``` ``` # Redirects only @bookstack:~$ sudo tail /var/log/apache2/access.log 192.168.7.212 - - [13/Apr/2024:11:58:37 -0300] "GET / HTTP/1.1" 302 1961 "-" "axios/1.6.7" 192.168.7.3 - - [13/Apr/2024:11:58:41 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0" 192.168.7.3 - - [13/Apr/2024:11:58:54 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0" 192.168.7.3 - - [13/Apr/2024:11:58:59 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/8.0.1" 192.168.7.212 - - [13/Apr/2024:12:03:52 -0300] "GET / HTTP/1.1" 302 1961 "-" "axios/1.6.7" 192.168.7.3 - - [13/Apr/2024:12:03:55 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0" 127.0.0.1 - - [13/Apr/2024:12:04:02 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/7.81.0" 192.168.7.3 - - [13/Apr/2024:12:07:24 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0" 192.168.7.3 - - [13/Apr/2024:12:13:19 -0300] "GET / HTTP/1.1" 302 1961 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0" 192.168.7.3 - - [13/Apr/2024:12:13:30 -0300] "GET / HTTP/1.1" 302 1905 "-" "curl/8.0.1" ``` ### Hosting Environment - `Ubuntu 22.04` - `MySQL 8.0.36` - `Apache/2.4.52` - `PHP 8.1.2`
OVERLORD added the 🐕 Support label 2026-02-05 09:08:13 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4624