BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
14.67k stars 1.85k forks source link

How to disable this IP/domain redirection? #4719

Closed cosmicDustOfLightLength closed 8 months ago

cosmicDustOfLightLength commented 8 months ago

Attempted Debugging

Searched GitHub Issues

Describe the Scenario

During installation, we provide the URL or IP, for example 192.168.1.12

Everything was installed correctly, by entering IP 192.168.5.12 in the browser, the page appears and you can log in.

I wanted to enter the domain instead of the IP, e.g. "bookstack.home.lan"

Just like for other such network services on my LAN. I entered a redirect in my DNS router from "bookstack.home.lan" to IP: 192.168.5.12.

DNS works, but now when you enter the domain "bookstack.home.lan" in the browser, it is automatically redirected to the IP address that was entered during installation.

Can this redirect be disabled somehow?

Due to this redirection from the domain to the IP in the browser, I am not able to configure the zero trust cloudflare tunnel to enter another domain from the public network to the LAN.

It doesn't work because it's a redirect.

While away from home in a public network, entering e.g. "bookstack.tunel.ovh", after authentication, it redirects me to the local IP address which is known only in the LAN network, not WAN.

How to disable this IP/domain redirection so that the browser shows any domain that has been entered for this host's IP address in DNS server. Didn't the browser redirect the address from the domain to the IP entered during installation?

Thanks!

Exact BookStack Version

v23.10.4

Log Content

No response

Hosting Environment

Ubuntu 22.04 Script

ssddanbrown commented 8 months ago

Hi @cosmicDustOfLightLength, To change the URL after running the script, you need to alter two files:

/var/www/bookstack/.env

Find the APP_URL entry in this file, then update it to be http://bookstack.home.lan (or https if active).

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

At about line 2 of this file, change the value for ServerName to be bookstack.home.lan instead of your IP. You'll need to restart apache after doing this. sudo systemctl restart apache2.service.


While away from home in a public network, entering e.g. "bookstack.tunel.ovh"

Note that BookStack only supports being hosted on one hostname/domain/origin-name at a time. Typically, where you may have different public/private addresses, you'd be better off standardising on the externally accessibly address for both, so use the external address for internal use also.

Man-in-Black commented 8 months ago

You should also make use of the following command as described here: https://www.bookstackapp.com/docs/admin/commands/#update-system-url

This is to alter all exisiting content to the new URL.

cosmicDustOfLightLength commented 8 months ago

Thanks, all mistake with .env and i put http instead https, now cloudflare tunnel work with this app perfect!