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

Login redirect not working correctly behind ingress #40

Open
skatsaounis opened this issue Nov 26, 2024 · 4 comments
Open

Login redirect not working correctly behind ingress #40

skatsaounis opened this issue Nov 26, 2024 · 4 comments

Comments

@skatsaounis
Copy link

Bug Description

When integrated with Traefik charm, when a user tries to access a page that requires authentication, the path prefix is not added, leading to 404:

To Reproduce

Follow the instructions: https://discourse.charmhub.io/t/netbox-docs-getting-started/13760 and then try to access from web as unathenticated user, e.g., the rack elevations:

http://k8s.fqdn/maas-model-netbox/dcim/rack-elevations/
--->
http://k8s.fqdn/login/?next=/maas-model-netbox/dcim/rack-elevations/
instead of
http://k8s.fqdn/maas-model-netbox/login/?next=/maas-model-netbox/dcim/rack-elevations/

Environment

App Version Status Scale Charm Channel Rev
netbox active 1 netbox latest/stable 21
postgresql-k8s 14.12 active 1 postgresql-k8s 14/stable 444
redis-k8s 7.2.5 active 1 redis-k8s latest/edge 38
s3-integrator active 1 s3-integrator latest/edge 79

juju version 3.5.3

Relevant log output

N/A

Additional context

No response

@skatsaounis
Copy link
Author

It seems that BASE_PATH should be set accordingly: https://netboxlabs.com/docs/netbox/en/stable/configuration/system/#base_path

@javierdelapuente
Copy link
Collaborator

Thanks for the report @skatsaounis

I am checking it now, with Traefik Rev 219, and when using the url from juju run traefik-k8s/0 show-proxied-endpoints --format=yaml, as you say, clicking on for example Racks redirect to http://.../None, however the top link "login" works.

Also adding a final / to the url, (like http://netbox_hostname/netbox-tutorial-netbox/ instead of http://netbox_hostname/netbox-tutorial-netbox), it doest not redirect to the root location.

Can you confirm that the same happens to you so we tackle that problem?

Thanks

@skatsaounis
Copy link
Author

Hi @javierdelapuente

I am observing the following:

  • Accessing the home page without the /, by using what juju run traefik-k8s/0 show-proxied-endpoints --format=yaml (http://netbox.fqdn/maas-model-netbox):
    • Racks link is: http://netbox.fqdn/None. This one is producing a Traefik 404 page
    • Login button is: http://netbox.fqdn/maas-model-netbox/login/?next=/maas-model-netbox/
  • Accessing the home page with the / (http://netbox.fqdn/maas-model-netbox/):
    • Racks link is: http://netbox.fqdn/maas-model-netbox/None. This one is producing a Netbox 404 page.
    • Login button is: http://netbox.fqdn/maas-model-netbox/login/?next=/maas-model-netbox/ (same as without the /)

@javierdelapuente
Copy link
Collaborator

Thank you for the report. The None maybe related to the upstream project.

I have added the jira bug for it, so at least we review the /.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants