nanawel / our-shopping-list

OSL is a simple shared list web-application based on Node and VueJS. Typical uses include shopping lists of course, and any other small todo-list that needs to be used collaboratively.
GNU Affero General Public License v3.0
82 stars 8 forks source link

Allow configuration of web root #18

Closed kungfoolfighting closed 1 year ago

kungfoolfighting commented 1 year ago

Hello, I would like to be able to reach OSL via something like https://myserver/osl/ rather than having to configure a different hostname for this service or a different port. I have tried creating clever nginx reverse proxy rules to achieve this by rewriting the contents of all the source files before they are served to the clients. This has been a bunch of work and still doesn't support every necessary function. It would be great if this could be added as a configuration parameter, where you can configure the webroot yourself. For example to "osl". I hope this would not be too difficult to do. Thanks for this great project. We have been using it for the last months and it is exactly what I was looking for: A lightweight app, that we can use to coordinate our in-store shopping and planning.

nanawel commented 1 year ago

Hi, and thanks very much :)

Hopefully that should not be too hard indeed. I'll take a look very soon.

nanawel commented 1 year ago

@kungfoolfighting The latest release 2.7.0 should now support what you need.

https://github.com/nanawel/our-shopping-list/releases/tag/2.7.0

If you're serving multiple instances on the same host, please read https://github.com/nanawel/our-shopping-list#-notes-when-serving-multiple-instances-on-different-web-roots

kungfoolfighting commented 1 year ago

Oh wow, thanks a bunch for the super speedy implementation of this! Greatly appreciated. I will give it a try today.

kungfoolfighting commented 1 year ago

I have tested this now and I can't quite get it to work with a reverse proxy. When simply connecting to the server via the port and the base url like this: http://myserver:port/osl/ it works flawlessly. But when using a reverse proxy (nginx) with the following configuration:

    location /osl/ {
            proxy_set_header Accept-Encoding "";
            proxy_pass http://myserver:port;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;
        }

It loads almost everything but doesn't show any boards. The console shows: chunk-vendors.59332c6d.js:1 GET http://myserver/boards/00000000-0000-0000-0000-000000000000 404 (Not Found)

So it is not using the base url for that specific request. Other requests do use the base url (for images and scripts etc.). Any idea if I am doing something wrong, or is there still an issue with the feature? Sorry for causing more work with this :(

nanawel commented 1 year ago

Hi, np, there might be some details missing even if I tried to cover all the possible cases.

You did not mention you set the BASE_URL in your container. Did you? This is mandatory. If you're serving the app on a custom web root, you have to set this variable in your environment section:

services:
  app:
    image: ...
    ...
    environment:
      BASE_URL: '/osl/'
kungfoolfighting commented 1 year ago

Oh yeah, sorry, I omitted mentioning that, since I thought the non-proxy version would not work at all with that url if I hadn't set the base url.

It looks like this:

    environment:
      # Default values below
      VUE_APP_I18N_LOCALE: en
      VUE_APP_I18N_FALLBACK_LOCALE: en
      VUE_APP_I18N_FORCE_LOCALE: 0
      VUE_APP_SINGLEBOARD_MODE: 1
      VUE_APP_LIST_ALL_BOARDS_ENABLED: 1
      BASE_URL: 'osl/'
kungfoolfighting commented 1 year ago

Also small correction: since I am in single board mode I should have said "it doesn't list any lists" rather than "it doesn't list any boards".

nanawel commented 1 year ago

Also small correction: since I am in single board mode I should have said "it doesn't list any lists" rather than "it doesn't list any boards".

You're right. There seems to be a bug with singleboard mode. Let me take a look.

nanawel commented 1 year ago

That should be fixed now with 2.7.1. Tell me if it works as expected in your environment.

kungfoolfighting commented 1 year ago

Works great now, thanks so much!