Login from Google redirects to private IP instead of public DNS address #958

Closed
opened 2026-02-04 23:09:52 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @justein230 on GitHub (Dec 19, 2018).

When I register a Google account, I get no error and I land on the Bookstack home page. But, when logging in with a Google account, it redirects to my internal IP address, which is inaccessible. Manually typing in my public DNS address fixes the issue (the user sees the homepage when logged in) but this is obviously not intended behavior.

Steps to reproduce:

Pre-requisites: Reverse proxy setup/app URL enabled.

  1. Register a Google user
  2. Log out of the account
  3. Sign back in, issue should reproduce

Running PHP v7.2, Bookstack v0.24.3.

Originally created by @justein230 on GitHub (Dec 19, 2018). When I register a Google account, I get no error and I land on the Bookstack home page. But, when logging in with a Google account, it redirects to my internal IP address, which is inaccessible. Manually typing in my public DNS address fixes the issue (the user sees the homepage when logged in) but this is obviously not intended behavior. Steps to reproduce: Pre-requisites: Reverse proxy setup/app URL enabled. 1. Register a Google user 2. Log out of the account 3. Sign back in, issue should reproduce Running PHP v7.2, Bookstack v0.24.3.
Author
Owner

@ssddanbrown commented on GitHub (Dec 19, 2018):

@justein230 Just to confirm, You have APP_URL set (and set only once) in the .env file to a URL that's not the IP?

Did you add the private IP to your app setup in google when setting it up? Would have thought Google would not even try and redirect you back to be honest.

@ssddanbrown commented on GitHub (Dec 19, 2018): @justein230 Just to confirm, You have `APP_URL` set (and set only once) in the `.env` file to a URL that's not the IP? Did you add the private IP to your app setup in google when setting it up? Would have thought Google would not even try and redirect you back to be honest.
Author
Owner

@justein230 commented on GitHub (Dec 23, 2018):

Sorry for the delay. Just checked my .env file, and APP_URL is only set once. In my experience, if APP_URL is not set properly, the graphics don't display right, and that is not happening at the moment. I also thought to check my Google setup, and couldn't find anything there either. All redirects are set properly.

The strange thing is that once I get redirected to that internal IP, if I just clear the URL bar and type in the DNS address, it shows me my homepage and I am logged in. It is just signing in that is broken.

@justein230 commented on GitHub (Dec 23, 2018): Sorry for the delay. Just checked my .env file, and `APP_URL` is only set once. In my experience, if APP_URL is not set properly, the graphics don't display right, and that is not happening at the moment. I also thought to check my Google setup, and couldn't find anything there either. All redirects are set properly. The strange thing is that once I get redirected to that internal IP, if I just clear the URL bar and type in the DNS address, it shows me my homepage and I am logged in. It is just signing in that is broken.
Author
Owner

@justein230 commented on GitHub (Dec 23, 2018):

Apologies for the increased activity on this, and thanks for all the help and suggestions. Found out it was an issue with my proxy... This fix might actually help me figure out some issues with other apps. Closing this out. Thanks!

FYI, for anyone using nginx to proxy Bookstack, add this to your location / directive:
proxy_set_header Host $host;

@justein230 commented on GitHub (Dec 23, 2018): Apologies for the increased activity on this, and thanks for all the help and suggestions. Found out it was an issue with my proxy... This fix might actually help me figure out some issues with other apps. Closing this out. Thanks! FYI, for anyone using nginx to proxy Bookstack, add this to your `location /` directive: `proxy_set_header Host $host;`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#958