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

Toggling darkmode results in an error #76

Closed
dkgof opened this issue Sep 15, 2022 · 8 comments · Fixed by #77
Closed

Toggling darkmode results in an error #76

dkgof opened this issue Sep 15, 2022 · 8 comments · Fixed by #77

Comments

@dkgof
Copy link

dkgof commented Sep 15, 2022

When pressing the toggle darkmode icon in the upper left, i get the following error:

FileNotFoundError FileNotFoundError: [Errno 2] No such file or directory: '/wiki/toggle-darktheme/None.md'

If i afterwards go back to the main page, or any other page, the theme has actually toggled, so its just the redirect that is not working.

I am running it from docker.

@Linbreux
Copy link
Owner

Hi @dkgof

Thanks for letting me know, I'll check it!

@Linbreux
Copy link
Owner

@dkgof what page were you on when you switched themes?

@dkgof
Copy link
Author

dkgof commented Sep 15, 2022

It seems to happen no matter what page i am on. My homepage, or any other page.

@Linbreux
Copy link
Owner

Hi @dkgof,
We use Referer to return to the page where you pressed the toggle switch. If you could give a little more detailed information. What version are you running? Does the page still exist?

@dkgof
Copy link
Author

dkgof commented Sep 15, 2022

I am running it behind a reverse nginx proxy, maybee something needs to be setup that i forgot to support this?

Not entirely sure how to see the version, but i installed it from your docker-compose example a few hours ago. So the latest version?

When looking at the network traffic in chrome dev tools, i dont see the Referer header, maybee that is the problem?

@dkgof
Copy link
Author

dkgof commented Sep 15, 2022

Just tested without the reverse proxy, directly from the IP, then it works. So i guess the proxy is doing something.

Also then the Referer header is present.

@dkgof
Copy link
Author

dkgof commented Sep 15, 2022

Apparently, digging a bit more into it, nginx does not proxy Referer, so as a temporary fix, i added the headerReferer "/" from nginx, so when i switch darkmode on/off, it sends me back to the frontpage, instead of the error. I guess that works well enough for me.

@Oliver-Hanikel
Copy link
Contributor

Some people also disable the Referer Header for privacy reasons in their Browser. We could instead put the current URL as a redirect in the link. Like it is done for the login.

kura added a commit to kura/wikmd that referenced this issue Sep 19, 2022
kura added a commit to kura/wikmd that referenced this issue Sep 19, 2022
kura added a commit to kura/wikmd that referenced this issue Sep 19, 2022
Linbreux added a commit that referenced this issue Sep 20, 2022
Change dark mode toggle to use a return path as a request argument rather than using the Referer header. Fixes #76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants