Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log in issue when site URL changed #8750

Open
1 of 7 tasks
Corn-101 opened this issue Dec 23, 2024 · 3 comments
Open
1 of 7 tasks

Log in issue when site URL changed #8750

Corn-101 opened this issue Dec 23, 2024 · 3 comments
Labels
question This is a question setup Relates to the InvenTree setup / installation process

Comments

@Corn-101
Copy link

Deployment Method

  • Installer
  • Docker Development
  • Docker Production
  • Bare metal Development
  • Bare metal Production
  • Digital Ocean image
  • Other (please provide a link Steps to Reproduce

Describe the problem*

I previously opened topic in Q&A of this but it seems it's not monitored so hopefully get answers from here. Here's the original post: https://github.com/inventree/InvenTree/discussions/8666#discussioncomment-11632144

So the issue is that Inventree Docker production installation when I change INVENTREE_SITE_URL from .env file from default inventree.localhost to INVENTREE_SITE_URL="http://192.168.1.102" I cannot login anymore. It seems to check the credentials as if I input deliberately wrong username/pwd, I get error message. But with correct credentials it just refreshes the page but wont let me in. With the default inventree.localhost I can log in normally. I've also tried to change the Caddyfile site url, but it didn't help. I've also tried to install everything from scratch (fresh Debian 12 install etc.) already two times, and every time the same issue. Could this be bug or am I missing something? Thank you.

Steps to Reproduce

  1. instructions https://docs.inventree.org/en/stable/start/docker_install/
  2. Install debian 12
  3. Install Docker and docker composer plugin
  4. Then follow the steps from step 0.
  5. modify .env file to INVENTREE_SITE_URL="http://192.168.1.102"

Relevant log output

@Corn-101 Corn-101 added question This is a question setup Relates to the InvenTree setup / installation process triage:not-checked Item was not checked by the core team labels Dec 23, 2024
@SchrodingersGat
Copy link
Member

@Corn-101 I have just tried to reproduce this but it seems to be functioning as intended on my end.

  1. Follow the install instructions from the docs
  2. Adjust INVENTREE_SITE_URL in .env (in my case http://192.168.1.100)
  3. Reload the server
  4. Login OK

Image

You should be able to find some docker logs as well as information from your browser, please post anything you can find

@matmair matmair removed the triage:not-checked Item was not checked by the core team label Dec 24, 2024
@Corn-101
Copy link
Author

Corn-101 commented Dec 24, 2024

Thank you. This is exactly the instructions I have followed, it seems my pasted link didn't work. Hopefully these logs have some hint, what's going on.
This from inventree-server. Correct credentials from another pc. No error message, just refresh the logon screen. No redirection to the index or whatsoever:
192.168.1.128 - - [24/Dec/2024:14:48:18 +0200] "GET / HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0" 192.168.1.128 - - [24/Dec/2024:14:48:19 +0200] "GET /accounts/login/?next=/ HTTP/1.1" 200 8637 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0" 192.168.1.128 - - [24/Dec/2024:14:48:25 +0200] "POST /accounts/login/ HTTP/1.1" 302 0 "http://192.168.1.102/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0" 192.168.1.128 - - [24/Dec/2024:14:48:25 +0200] "GET / HTTP/1.1" 302 0 "http://192.168.1.102/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0" 192.168.1.128 - - [24/Dec/2024:14:48:25 +0200] "GET /accounts/login/?next=/ HTTP/1.1" 200 8637 "http://192.168.1.102/accounts/login/?next=/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0"
inventree-worker
Loading config file : /home/inventree/data/config.yaml Waiting for database connection... Python version 3.11.9 - /usr/local/bin/python3 /root/.local/lib/python3.11/site-packages/allauth/exceptions.py:9: UserWarning: allauth.exceptions is deprecated, use allauth.core.exceptions warnings.warn("allauth.exceptions is deprecated, use allauth.core.exceptions") Waiting for database... Database connection successful! Python version 3.11.9 - /usr/local/bin/python3 /root/.local/lib/python3.11/site-packages/allauth/exceptions.py:9: UserWarning: allauth.exceptions is deprecated, use allauth.core.exceptions warnings.warn("allauth.exceptions is deprecated, use allauth.core.exceptions")
inventree-proxy:
{"level":"info","ts":1735028288.220092,"msg":"using config from file","file":"/etc/caddy/Caddyfile"} {"level":"info","ts":1735028288.2349286,"msg":"adapted config to JSON","adapter":"caddyfile"} {"level":"warn","ts":1735028288.2400007,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":30} {"level":"info","ts":1735028288.249413,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//127.0.0.1:2019","//localhost:2019","//[::1]:2019"]} {"level":"warn","ts":1735028288.2502167,"logger":"http.auto_https","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80} {"level":"info","ts":1735028288.2597978,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0003c1f00"} {"level":"info","ts":1735028288.2622316,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]} {"level":"info","ts":1735028288.2682698,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"} {"level":"info","ts":1735028288.268506,"msg":"serving initial configuration"} {"level":"info","ts":1735028288.2834492,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"5c270144-03e0-480d-b70f-de29cb9846de","try_again":1735114688.2834432,"try_again_in":86399.999998317} {"level":"info","ts":1735028288.283657,"logger":"tls","msg":"finished cleaning storage units"}

Location of Caddyfile, .env and docker-compose is /opt/inventree/. INVENTREE_EXT_VOLUME=./inventree-data as well as config.yaml is located in this inventree-data -folder.

My understanding is that it does accept the credentials, but it somehow fails to redirect to the home page...

@Corn-101
Copy link
Author

I managed to fix this. I had to add following lines to .env file:
INVENTREE_SESSION_COOKIE_SECURE=False INVENTREE_CSRF_COOKIE_SECURE=False
Please update your documentation to include this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question setup Relates to the InvenTree setup / installation process
Projects
None yet
Development

No branches or pull requests

3 participants