linuxserver / docker-snipe-it

Alpine/Nginx container for the Asset Management software Snipe-IT
GNU General Public License v3.0
123 stars 26 forks source link

[BUG] Unable to use SnipeIT buttons due to erroneous URL behaviour #61

Closed madtempest closed 1 year ago

madtempest commented 1 year ago

Is there an existing issue for this?

Current Behavior

Running the Latest image of Snipe-IT Container is behind a containerised NGINX reverse proxy When trying to edit an existing asset, or People account, the URL being presented is in the format https://snipe.domain.com/snipe.domain.com/hardware/XX/edit

When the environment varaible APP_URL is set, the URL instead becomes snipe.domain.com:80/hardware/XX/edit

Expected Behavior

When trying to edit an existing asset, or People account, the URL being presented is in the format https://snipe.domain.com/hardware/XX/edit

Steps To Reproduce

Create a new Snipe IT and MariaDB set of containers using the Linuxserver.io images via docker compose Set the APP_URL environment variable. Add a reverse proxy to the containers. Add a new asset or license or other object. Attempt to edit the object. Note the URL of the edit/checkin/etc buttons is incorrect.

Environment

- OS: Ubuntu 22.04
- How docker service was installed: via apt package.

CPU architecture

arm64

Docker creation

snipe-it:
    image: linuxserver/snipe-it:latest
    container_name: snipe-it
    restart: always
    depends_on:
      - mariadb
    links:
      - mariadb
    volumes:
      - ./snipe:/config
    environment:
      - APP_URL=snipe.domain.com:80
      - MYSQL_PORT_3306_TCP_ADDR=172.28.6.10
      - MYSQL_PORT_3306_TCP_PORT=3306
      - MYSQL_DATABASE=
      - MYSQL_USER=
      - MYSQL_PASSWORD=
      - PGID=1000
      - PUID=1000
      - TZ=Australia/Perth
      - APP_TRUSTED_PROXIES=172.28.6.254
    ports:
      - 8086:80
    networks:
      network:
            ipv4_address: 172.28.6.53

Container logs

██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 
   Brought to you by linuxserver.io
───────────────────────────────────────
To support the app dev(s) visit:
Snipe-IT: https://snipeitapp.com/donate
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
using keys found in /config/keys
Nothing to migrate.
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│            │ 2023-04-13 │ /config/nginx/site-confs/default.conf                                  │
│ 2021-06-15 │ 2023-04-13 │ /config/nginx/nginx.conf                                               │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
**** The following site-confs have extensions other than .conf ****
**** This may be due to user customization. ****
**** You should review the files and rename them to use the .conf extension or remove them. ****
**** nginx.conf will only include site-confs with the .conf extension. ****
/config/nginx/site-confs/default
[custom-init] No custom files found, skipping...
[ls.io-init] done.
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

zakpatat commented 1 year ago

Our company is having this same issue. It also prevents us from assigning hardware to users.

aptalca commented 1 year ago
  1. The APP_URL is not set correctly, it's missing the proto
  2. Nginx confs need updating (listed in the log)
  3. I'm confused about the observed behavior. One sentence says https://snipe.domain.com/snipe.domain.com/hardware/XX/edit and the other says snipe.domain.com:80/hardware/XX/edit. Which is it? And if the second is correct, then what's the issue? That's what the APP_URL is set to.

If the expected url is https://snipe.domain.com/hardware/XX/edit, then why is the APP_URL set to snipe.domain.com:80? Default https port is 443, not 80

In any case, this looks like pebkac and not a bug. Closing

If the issue persists, please open a new issue with a clearer explanation of observed behavior

madtempest commented 1 year ago

@zakpatat Clearly something has changed in an image as we both have experienced an issue despite not changing our docker compose configs. Whereas the need for the protocol in the APP_URL is 100% required now (it fixes the issue), it previously worked without it, mirroring the behaviour that was present when the APP_URL environment variable was the NGINX_APP_URL variable which didn't need the protocol specified (as per the README docs).

The change to need the protocol appears to have been in a release in March 2022 according to README commit history, but again it clearly wasn't breaking anything until recently.

Either way, fix the APP_URL variable to include the protocol as per the current README docs and recreate the container and it should work fine.

zakpatat commented 1 year ago

Can confirm that adding protocol to the APP_URL fixes this issue.