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

Wrong token using httpd and relayd on openbsd #2066

Open
caywin25 opened this issue Jan 24, 2024 · 6 comments
Open

Wrong token using httpd and relayd on openbsd #2066

caywin25 opened this issue Jan 24, 2024 · 6 comments
Labels
feedback needed server support installation and configuration issues

Comments

@caywin25
Copy link

caywin25 commented Jan 24, 2024

Hello

I find myself facing a problem.
I can't share an article with the "Shaare link" button

When I open the window and enter my credentials, I get the message Wrong token and I cannot share the link.

It seems to me that it is because of my reverse proxy.
My configuration is as follows:

  • My reverse proxy listens on ports 443 and 80 and my web server on port 8080

Log on my webserver with Wrong token message :

<domain> 127.0.0.1 - - [24/Jan/2024:19:57:25 +0100] "POST /login?returnurl=%2Fadmin%2Fshaare%3Fpost%3Dhttps%253A%252F%252Fgithub.com%252Fshaarli%252FShaarli%252Fpulls%26title%3DPull%2520requests%2520%25C2%25B7%2520shaarli%252FShaarli%2520%25C2%25B7%2520GitHub%26description%3D%26source%3Dbookmarklet HTTP/1.1" 403 0 "https://domain.fr/login%3Freturnurl=%252Fadmin%252Fshaare%253Fpost%253Dhttps%25253A%25252F%25252Fgithub.com%25252Fshaarli%25252FShaarli%25252Fpulls%2526title%253DPull%252520requests%252520%2525C2%2525B7%252520shaarli%25252FShaarli%252520%2525C2%2525B7%252520GitHub%2526description%253D%2526source%253Dbookmarklet" "Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0" <IP> -

I think that's where the problem comes from.
Could you please help me ?

@caywin25
Copy link
Author

I just did new tests.
If I log in directly to my shaarli site and I want to share a link with the "Shaare link" window I get the error: Wrong token.

If I am not logged in on my shaarli site but I log in from the small window ¨Shaare link¨ I can share any links.

Finally if I log into the small "shaare link" window and on my shaarli site one of the will return the Wrong Token error and will be unusable

@nodiscc
Copy link
Member

nodiscc commented Jan 24, 2024

Hi,

It seems to me that it is because of my reverse proxy.

Please post

  • your shaarli version and installation method used (releae zip, source+composer, docker...)
  • the relevant virtualhost/server configuration of your reverse proxy/web server

@nodiscc nodiscc added server support installation and configuration issues labels Jan 24, 2024
@caywin25
Copy link
Author

caywin25 commented Jan 25, 2024

Hello

Thanks for your reply.
I'm using httpd ans relayd on openbsd and I installed shaarli with zip
I know is not standard :)

httpd.conf

server "perso.shaarli.org" {
        listen on 127.0.0.1 port 8080

        log style forwarded
        log {
                access "access.log"
                error "error.log"
        }

        location "/tpl/*" {
            root "/htdocs/shaarli"
        }

        location "*.php" {
            root "/htdocs/shaarli"
            fastcgi socket "/run/php-fpm.sock"
        }

        location "*index.php*" {
            root "/htdocs/shaarli"
            fastcgi socket "/run/php-fpm.sock"
        }

        location match "/(.*)" {
            request rewrite "/index.php/%1"
        }

        location "/*" {
            root "/htdocs/shaarli"
        }
        gzip-static
}

server "perso.shaarli.org" {
        listen on 127.0.0.1 port 8081
        block return 301 "https://$HTTP_HOST$REQUEST_URI"
}

relayd.conf

match request header set "X-Forwarded-For" value "$REMOTE_ADDR"
match request header set "X-Real-IP" value "$REMOTE_ADDR"

Above are the headers that I pass to VHOST
The rest of the conf is just standard for the 443

Thank for your help

@nodiscc nodiscc changed the title Wrong token Wrong token using httpd and relayd on openbsd Feb 2, 2024
@nodiscc
Copy link
Member

nodiscc commented Feb 10, 2024

Does accessing /admin/token on your instance return a token?

Are there errors in the browser console or webserver logs?

@nodiscc nodiscc added this to the backlog to the future milestone Feb 24, 2024
@nodiscc nodiscc removed the help-wanted help-wanted label Feb 24, 2024
@nodiscc
Copy link
Member

nodiscc commented Mar 10, 2024

Hi @caywin25 did you get a chance to check /admin/token on your instance, as requested above?

@caywin25
Copy link
Author

caywin25 commented May 5, 2024

Hello @nodiscc
Sorry for delay
Yes if I go to /admin/token I have my token

Thanks
Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback needed server support installation and configuration issues
Projects
None yet
Development

No branches or pull requests

2 participants