Web based family history software

Question webtrees IP Help

  • MaxTheSpy
  • Topic Author
  • Offline
  • New Member
  • New Member
More
4 months 3 weeks ago - 4 months 3 weeks ago #1 by MaxTheSpy
webtrees IP Help was created by MaxTheSpy
Hello everyone! Im running webtrees on a raspberry pi as well as mysql and adminer to manage mysql with a webui all done through docker. Additionally I am running tailscale to allow remote connections. I have found that locally on my home network I can connect to webtrees through 10.0.0.69 which is an IP I have reserved for the pi through my router. when I log in it shows up as "https://10.0.0.69/index.php?route=%2F" in the browser.

I tried loading the page outside of my home network by using the tailscale IP, but it always forwards to 10.0.0.69 even when Im not local. The webtrees webui does not load when this happens. When I go through and attempt to get adminer on port 8080 on the tailscale ip, it works just fine and I am able to access it. Adminer is not forwarding to 10.0.0.69.

That being said, occasionally my router seems to unassign the .69 ip address and then I cannot access it locally, I cannot access it through tailscale either since webtrees seems to default to the .69 ip and not pick up whatever else was assigned.

Anyone run into an issue like this? I can provide whatever other information, Im just not really sure what Im looking for at this point. Thank you in advance

EDIT: Im fairly convinced that the issue is the same thing outlined in this post: www.webtrees.net/index.php/forum/help-fo...p-of-a-webtrees-site

The base url being set to local and not set to the tailscale ip. Is there a way to specify both Local IP AND Tailscale IP?
Last edit: 4 months 3 weeks ago by makitso.

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #2 by fisharebest
Replied by fisharebest on topic webtrees IP Help
> The base url being set to local and not set to the tailscale ip. Is there a way to specify both Local IP AND Tailscale IP?

webtrees needs to generate absolute URLs.

It does this using the "base_url" setting in the file data/config.ini.php.

This is set during installation (webtrees uses JS to read the URL from your browser). If you subsequently change the URL, you must update this value.

If you want webtrees to choose between two different base_url values at runtime, then you need to supply logic to choose the URL.

You can do this with a custom module. You need to create a "middleware" module. There's an example available at github.com/webtrees/example-module-middleware

You need to use code like this:
Code:
$base_url = ... your logic here ... $request = $request->withAttribute('base_url', $base_url);

I guess your logic probably involves looking at the request HTTP headers. You'd fetch them with
Code:
$some_header = $request->getHeaderLine('some_header');

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum