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

1.6.0-RC* webroot does not work properly #751

Closed
gili-gili opened this issue Oct 12, 2023 · 11 comments · Fixed by #775
Closed

1.6.0-RC* webroot does not work properly #751

gili-gili opened this issue Oct 12, 2023 · 11 comments · Fixed by #775
Assignees
Labels
type:bug Something isn't working
Milestone

Comments

@gili-gili
Copy link

gili-gili commented Oct 12, 2023

Data

  • Shiori version: v1.2.5 1.6.0-rc.3
  • Database Engine: PostgreSQL
  • Operating system: Arch Linux
  • CLI/Web interface/Web Extension: do not matter

Describe the bug / actual behavior

I'm running shiori with systemd and postgresql
If I set SHIORI_DIR, then shiori would ignore SHIORI_DATABASE_URL and try to create sqlite database under SHIORI_DIR

Expected behavior

They should work together.

To Reproduce

just execute export xxx=xxx

Screenshots

no

Notes

need further information

@gili-gili gili-gili added the type:bug Something isn't working label Oct 12, 2023
@github-project-automation github-project-automation bot moved this to To do in Roadmap Oct 12, 2023
@gili-gili
Copy link
Author

well it seems that shiori doesn't honor SHIORI_DATABASE_URL at all
I tried export SHIORI_DATABASE_URL=xxx and SHIORI_DATABASE_URL=xxx shiori serve but none of them worked
Am I doing anything wrong?

@gili-gili gili-gili changed the title SHIORI_DATABASE_URL and SHIORI_DIR doesn't work together SHIORI_DATABASE_URL not working Oct 13, 2023
@gili-gili
Copy link
Author

fixed in v1.6.0-rc.3

@github-project-automation github-project-automation bot moved this from To do to Done in Roadmap Oct 13, 2023
@gili-gili
Copy link
Author

And then --webroot is not working! Tested in v1.6.0-rc.2 and v1.6.0-rc.3

@gili-gili gili-gili reopened this Oct 13, 2023
@github-project-automation github-project-automation bot moved this from Done to In progress in Roadmap Oct 13, 2023
@gili-gili gili-gili changed the title SHIORI_DATABASE_URL not working Cannot set webroot in 1.6.3-RC3 Oct 13, 2023
@gili-gili gili-gili changed the title Cannot set webroot in 1.6.3-RC3 Cannot set webroot in 1.6.0-RC3 Oct 13, 2023
@gili-gili
Copy link
Author

gili-gili commented Oct 13, 2023

Also, in RC3, shiroki won't redirect users to login page automaticly if they were not logged in yet. Here is the log and error messsage


2023/10/13 17:24:11 [Recovery] 2023/10/13 - 17:24:11 panic recovered:
error parsing token: token is malformed: token contains an invalid number of segments
/home/runner/work/shiori/shiori/internal/webserver/utils.go:102 (0xcaf6f0)
/home/runner/work/shiori/shiori/internal/webserver/handler-api.go:66 (0xcae718)
/home/runner/work/shiori/shiori/internal/http/routes/legacy.go:37 (0xd73b52)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x979679)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x979667)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x979679)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x979667)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xd7833c)
/home/runner/go/pkg/mod/github.com/toorop/[email protected]/logger.go:43 (0xd78323)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xca06ab)
/home/runner/go/pkg/mod/github.com/gin-contrib/[email protected]/requestid.go:48 (0xca0699)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x97855a)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0x9781ed)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0x977d1c)
/opt/hostedtoolcache/go/1.21.1/x64/src/net/http/server.go:2938 (0x6e5bcd)
/opt/hostedtoolcache/go/1.21.1/x64/src/net/http/server.go:2009 (0x6e1ab3)
/opt/hostedtoolcache/go/1.21.1/x64/src/runtime/asm_amd64.s:1650 (0x46b9c0)
ERROR

error parsing token: token is malformed: token contains an invalid number of segments (500)

Probably caused by eb666cd
Update:

  • --webroot only works for static files, sucks
  • shiori account won't be deleted after a new account is created (using postgresql)

@gili-gili gili-gili changed the title Cannot set webroot in 1.6.0-RC3 1.6.0-RC3 is buggy Oct 13, 2023
@fmartingr
Copy link
Member

The error you experience with the malformed token is solved by #748. Webroot wasn't taken care by the new server I think, let me check if I can do a quick PR.

Thanks for detailing your findings, really appreciated!

@fmartingr
Copy link
Member

Which reverse proxy are you using? I was thinking about this, and maybe is easier to tell your reverse proxy to avoid sending the prefixed path entirely? That's how I did it in the past on other services of mine.

@gili-gili
Copy link
Author

Nginx. Currently no rewrite rules applied.

@gili-gili
Copy link
Author

Summary

error parsing token: token is malformed

Fixed in #748 ( I downloaded the artifacts and tested )
However the error log still exists and is a bit annoying

2023/10/16 00:00:00 [Recovery] 2023/10/16 - 00:00:00 panic recovered:
session has been expired
/home/runner/work/shiori/shiori/internal/webserver/utils.go:102 (0xcaf830)
/home/runner/work/shiori/shiori/internal/webserver/handler-api.go:66 (0xcae858)
/home/runner/work/shiori/shiori/internal/http/routes/legacy.go:37 (0xd73cb2)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x979679)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x979667)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x979679)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x979667)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xd7849c)
/home/runner/go/pkg/mod/github.com/toorop/[email protected]/logger.go:43 (0xd78483)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xca06ab)
/home/runner/go/pkg/mod/github.com/gin-contrib/[email protected]/requestid.go:48 (0xca0699)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x97855a)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0x9781ed)
/home/runner/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0x977d1c)
/opt/hostedtoolcache/go/1.21.1/x64/src/net/http/server.go:2938 (0x6e5bcd)
/opt/hostedtoolcache/go/1.21.1/x64/src/net/http/server.go:2009 (0x6e1ab3)
/opt/hostedtoolcache/go/1.21.1/x64/src/runtime/asm_amd64.s:1650 (0x46b9c0)

--webroot only works for static files

First appeared in v1.6.0-RC1. Waiting for fix.
Workaround: use both --webroot in shiori and rewrite rules provided by reverse proxy software. Example configuration for nginx:

    location /shiori {
        rewrite ^/shiori(.*)$ $1 break;
        proxy_pass            http://127.0.0.1:8080;
    }

shiori account won't be deleted after a new account is created

I encountered this when using postgresql in v1.6.0-RC3. I have not tested this with sqlite3

@fmartingr
Copy link
Member

--webroot only works for static files

Have you tried adding a final slash to the proxy_pass directive (without the --webroot flag)?

        proxy_pass            http://127.0.0.1:8080/;

@gili-gili
Copy link
Author

--webroot only works for static files

Have you tried adding a final slash to the proxy_pass directive (without the --webroot flag)?

        proxy_pass            http://127.0.0.1:8080/;

After adding a slash, now it's working!
idk why but in versions lower than v1.6.0-RC1 shiori can handle it correctly without the final slash. Maybe we should remind users of this in the documentation?

@gili-gili
Copy link
Author

gili-gili commented Nov 5, 2023

Update: Unfortunately --webroot do not work with archived pages.
Use --webroot /shiori/
Works for readable, not archived

@fmartingr fmartingr self-assigned this Nov 11, 2023
@fmartingr fmartingr changed the title 1.6.0-RC3 is buggy 1.6.0-RC* webroot does not work properly Nov 11, 2023
@fmartingr fmartingr added this to the 1.6.0 milestone Nov 11, 2023
@github-project-automation github-project-automation bot moved this from In progress to Done in Roadmap Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants