Bookstack behind Caddy Reverse Proxy not working #644

Closed
opened 2026-02-04 21:34:19 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @Riouken on GitHub (Apr 14, 2018).

For Bug Reports

Ubuntu 16.04 vm
Installed with Ubuntu script.

  • BookStack Version (Found in settings, Please don't put 'latest'): BookStack v0.20.3
  • PHP Version: PHP 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )
  • MySQL Version: mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper
Expected Behavior

Normal operation through Wan.

Current Behavior

Bookstack works well through http lan. But if I enable the https caddy proxy and attempt to reach it from WAN it appears that the css is not loading.

I have set the APP_URL:
APP_URL=https://myfqd/bookstack

My CaddyFile:
#Bookstack proxy /bookstack 192.168.1.59 { transparent }

But after setting the APP_URL the site will not load correctly. Either from WAN or LAN. This is what it looks like:

bookstack - google chrome 4_14_2018 9_54_08 am
bookstack - google chrome 4_14_2018 9_54_17 am
bookstack - google chrome 4_14_2018 9_54_31 am
bookstack - google chrome 4_14_2018 9_54_36 am

Originally created by @Riouken on GitHub (Apr 14, 2018). ### For Bug Reports Ubuntu 16.04 vm Installed with Ubuntu script. * BookStack Version *(Found in settings, Please don't put 'latest')*: **BookStack v0.20.3** * PHP Version: **PHP 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )** * MySQL Version: **mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapper** ##### Expected Behavior Normal operation through Wan. ##### Current Behavior Bookstack works well through http lan. But if I enable the https caddy proxy and attempt to reach it from WAN it appears that the css is not loading. I have set the APP_URL: `APP_URL=https://myfqd/bookstack` My CaddyFile: ` #Bookstack proxy /bookstack 192.168.1.59 { transparent } ` But after setting the APP_URL the site will not load correctly. Either from WAN or LAN. This is what it looks like: ![bookstack - google chrome 4_14_2018 9_54_08 am](https://user-images.githubusercontent.com/2192670/38769752-95c8357a-3fcd-11e8-82dc-26a2e16cbdbd.png) ![bookstack - google chrome 4_14_2018 9_54_17 am](https://user-images.githubusercontent.com/2192670/38769754-996f2850-3fcd-11e8-99a1-6a5545276a57.png) ![bookstack - google chrome 4_14_2018 9_54_31 am](https://user-images.githubusercontent.com/2192670/38769758-9e0a37b0-3fcd-11e8-96bf-3d8792bbfd64.png) ![bookstack - google chrome 4_14_2018 9_54_36 am](https://user-images.githubusercontent.com/2192670/38769760-a0346f6a-3fcd-11e8-88cf-f385139738b3.png)
OVERLORD added the 🐕 Support label 2026-02-04 21:34:19 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 15, 2018):

Hi @Riouken, Sorry to hear you're having issues.

I've taken a look at your instance (URL on one of the screenshots) and all links, including those to CSS, within the HTML do not include the /bookstack/ path component.

Can you double check APP_URL is set and includes /bookstack/? How are you setting that variable?

@ssddanbrown commented on GitHub (Apr 15, 2018): Hi @Riouken, Sorry to hear you're having issues. I've taken a look at your instance (URL on one of the screenshots) and all links, including those to CSS, within the HTML do not include the `/bookstack/` path component. Can you double check `APP_URL` is set and includes `/bookstack/`? How are you setting that variable?
Author
Owner

@Riouken commented on GitHub (Apr 15, 2018):

I had commented out the APP_URL so that I could access it again.

To change the APP_URL:
I am editing the .env file in: /var/www/bookstack/

I am using nano to edit it and then saving, then restarting the server.

@Riouken commented on GitHub (Apr 15, 2018): I had commented out the APP_URL so that I could access it again. To change the APP_URL: I am editing the .env file in: /var/www/bookstack/ I am using nano to edit it and then saving, then restarting the server.
Author
Owner

@skluthe commented on GitHub (Apr 19, 2018):

On your bookstack server you should edit your .env and change the line to this:
APP_URL=https://sub.domain.tld

Make sure you change it to HTTPS. This will get it to work. I'm using it behind a Caddy reverse proxy too.

@skluthe commented on GitHub (Apr 19, 2018): On your bookstack server you should edit your .env and change the line to this: APP_URL=https://sub.domain.tld Make sure you change it to HTTPS. This will get it to work. I'm using it behind a Caddy reverse proxy too.
Author
Owner

@ssddanbrown commented on GitHub (Sep 23, 2018):

Since there was no response to the last comment and it's confirmed about that BookStack can work behind a caddy proxy I'm going to close this. If the issue remains and is something you still require to be fixed please comment and this can be reopened if required.

@ssddanbrown commented on GitHub (Sep 23, 2018): Since there was no response to the last comment and it's confirmed about that BookStack can work behind a caddy proxy I'm going to close this. If the issue remains and is something you still require to be fixed please comment and this can be reopened if required.
Author
Owner

@mikeg1130 commented on GitHub (Feb 18, 2020):

I'm using it behind a Caddy reverse proxy too.

Sorry to resurrect this issue. @skluthe , can you share your CaddyFile entry for BookStack? I am using the Linuxserver.io docker image, have APP_URL set appropriately in the .env file, but am getting a 502 Bad Gateway error when navigating to the URL. Here are my config entries:

.env
APP_URL=https://wiki.domain.com

CaddyFile
wiki.domain.com { proxy / 192.168.1.2:6875 { transparent } }

I am able to swap a different ip:port in the CaddyFile (a ghost blog) and the url resolves fine in that instance.

@mikeg1130 commented on GitHub (Feb 18, 2020): > I'm using it behind a Caddy reverse proxy too. Sorry to resurrect this issue. @skluthe , can you share your CaddyFile entry for BookStack? I am using the Linuxserver.io docker image, have APP_URL set appropriately in the .env file, but am getting a 502 Bad Gateway error when navigating to the URL. Here are my config entries: .env `APP_URL=https://wiki.domain.com` CaddyFile `wiki.domain.com { proxy / 192.168.1.2:6875 { transparent } }` I am able to swap a different ip:port in the CaddyFile (a ghost blog) and the url resolves fine in that instance.
Author
Owner

@doubleangels commented on GitHub (May 3, 2020):

Sorry to resurrect this issue again, but I'm having the same issye as @mikeg1130.

APP_URL=https://bookstack.domain.com

Caddyfile:
bookstack.app.com { encode gzip zstd log { output stderr } reverse_proxy / localhost:6875 tls me@mydomain.com }

I keep getting the 502 bad gateway error as well.

@doubleangels commented on GitHub (May 3, 2020): Sorry to resurrect this issue again, but I'm having the same issye as @mikeg1130. `APP_URL=https://bookstack.domain.com` Caddyfile: `bookstack.app.com { encode gzip zstd log { output stderr } reverse_proxy / localhost:6875 tls me@mydomain.com }` I keep getting the 502 bad gateway error as well.
Author
Owner

@mikeg1130 commented on GitHub (May 3, 2020):

For me, it turned out I’d forgotten to open the port on my firewall.

@mikeg1130 commented on GitHub (May 3, 2020): For me, it turned out I’d forgotten to open the port on my firewall.
Author
Owner

@doubleangels commented on GitHub (May 5, 2020):

That's strange, I've even completely disabled the firewall and checked ufw logs and it still wouldn't work. In the meantime I've set things up behind an Nginx reverse proxy.

@doubleangels commented on GitHub (May 5, 2020): That's strange, I've even completely disabled the firewall and checked ```ufw``` logs and it still wouldn't work. In the meantime I've set things up behind an Nginx reverse proxy.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#644