openbooks icon indicating copy to clipboard operation
openbooks copied to clipboard

Base URL

Open samcro1967 opened this issue 4 years ago • 11 comments

Is there a way to have it listen on http://ip:port/baseurl instead of http://ip:port for putting behind a reverse proxy?

samcro1967 avatar Jul 03 '21 16:07 samcro1967

would like to have this as well. When using a reverse proxy I am getting this

2021/07/22 07:43:28 websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header

sbelongie avatar Jul 22 '21 12:07 sbelongie

I got this working with turning on websockets,Asset Caching,and HSTS in my config. @samcro1967

example config

------------------------------------------------------------

subdomain.domain.com

------------------------------------------------------------

server { set $forward_scheme http; set $server "192.168.1.x"; set $port 8181;

listen 8080; listen [::]:8080;

listen 4443 ssl http2; listen [::]:4443;

server_name subdomain.domain.com;

Let's Encrypt SSL

include conf.d/include/letsencrypt-acme-challenge.conf; include conf.d/include/ssl-ciphers.conf; ssl_certificate /etc/letsencrypt/live/npm-37/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/npm-37/privkey.pem;

Asset Caching

include conf.d/include/assets.conf;

HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)

add_header Strict-Transport-Security "max-age=63072000; preload" always;

Force SSL

include conf.d/include/force-ssl.conf;

proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1;

access_log /data/logs/proxy_host-15.log proxy;

location / { # HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years) add_header Strict-Transport-Security "max-age=63072000; preload" always;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_http_version 1.1;

# Proxy!
include conf.d/include/proxy.conf;

}

Custom

include /data/nginx/custom/server_proxy[.]conf; }

sbelongie avatar Jul 26 '21 13:07 sbelongie

Glad you got it working. I am using Caddy instead of nginx, but it may help others down the road.

samcro1967 avatar Jul 26 '21 16:07 samcro1967

@evan-buss Is this something you can add to a future releaae?

samcro1967 avatar Aug 21 '21 18:08 samcro1967

@samcro1967 @sbelongie

I've added application support for specifying the base path. Please try it out and let me know if you have any issues. You may have to adjust your reverse proxy settings, but they should be a lot simpler.

Instructions

evan-buss avatar Aug 23 '21 03:08 evan-buss

Works perfectly. Thanks!

samcro1967 avatar Aug 23 '21 11:08 samcro1967

This seems to have stopped working since the last update.

samcro1967 avatar Dec 09 '21 13:12 samcro1967

Hmm. I will take a look. Thanks for reporting!

evan-buss avatar Dec 09 '21 19:12 evan-buss

A little more testing and what I found...

I was only serving this up with caddy externally. I setup caddy to serve it internally and it works as expected. Externally it seems to work with Edge, but not Chrome. Externally in Chrome, sometimes I get page not found, other times I get a partially loaded page (screen shot below). Clearing Chrome cache got me a little further, but it still does not load the same in Chrome externally as it does internally or with Edge externally. I also tried private mode in both Edge and Chrome. They both work internally, but neither works externally.

Externally before clearing Chrome Cache image

Externally after clearing Chrome cache image

How it looks in Edge externally image

samcro1967 avatar Dec 16 '21 11:12 samcro1967

when i put mine is baseurl https://domain.com/services/openbooks i get a 404 error

anoosa1 avatar Jan 02 '22 04:01 anoosa1

I have it working with npm as proxy host

Add proxy host, set up domain names Scheme http forward to container name or ip port 80 Set Websockets Support on

Add custom locations / forward to ip or container name/openbooks/ port 80 add these on the cogwheel

add_header Strict-Transport-Security "max-age=63072000; preload" always; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection;

Set up SSL with all things enabled And last on Advanced add_header Strict-Transport-Security "max-age=63072000; preload" always;

With all of that i made it work perfectly behind nginx proxy manager

Albrod avatar Jan 19 '22 23:01 Albrod