BookLore icon indicating copy to clipboard operation
BookLore copied to clipboard

Kobo Proxy Response Status 401 on Kobo Sync (continuing #1027)

Open m-zaw opened this issue 2 months ago • 13 comments

I'm really sorry but I have to reopen.

Still 401 error even after regenerating token. Both via reverse proxy and local IP.

This is the response when opening the url: http://LOCAL_IP:6060/api/kobo/49f3247a-1ebc-4d43-8671-4e396eeef172 {"ResponseStatus":{"ErrorCode":"UnauthorizedAccessException","Message":"Unauthorized Request. Missing authentication token."}}

And those are the logs: 2025-10-03T12:22:25.847+01:00 INFO 10 --- [booklore-api] [io-8080-exec-39] c.a.b.service.kobo.KoboServerProxy : Kobo proxy URL: https://storeapi.kobo.com 2025-10-03T12:22:26.171+01:00 INFO 10 --- [booklore-api] [io-8080-exec-39] c.a.b.service.kobo.KoboServerProxy : Kobo proxy response status: 401 ^^ When trying via local IP.

2025-10-03T12:22:37.530+01:00 INFO 10 --- [booklore-api] [nio-8080-exec-1] c.a.b.service.kobo.KoboServerProxy : Kobo proxy URL: https://storeapi.kobo.com 2025-10-03T12:22:37.670+01:00 INFO 10 --- [booklore-api] [nio-8080-exec-1] c.a.b.service.kobo.KoboServerProxy : Kobo proxy response status: 401 ^^ When trying via reverse proxy.

Originally posted by @m-zaw in #1027

m-zaw avatar Oct 03 '25 11:10 m-zaw

I'm getting the same error.

alecmekarzel avatar Oct 10 '25 00:10 alecmekarzel

I love to use this feature but got the same error message. Can't get it to work.

remc0 avatar Oct 10 '25 06:10 remc0

Same error here

steven-baehr avatar Nov 16 '25 19:11 steven-baehr

Same error here. Version 1.10.0

canemacchina avatar Nov 18 '25 23:11 canemacchina

Same error for me on the currently latest version 1.11.0. Edit: Doesn't really seem to matter for the Kobo sync to actually work?

Flaxee avatar Nov 25 '25 10:11 Flaxee

Same error here with v1.12.0 using:

http://192.168.14.35:6070/api/kobo/c109c80b-f9df-45cc-bc6a-123456789d494

Server log: 2025-11-26T19:32:52.606Z INFO 9 --- [booklore-api] [nio-8080-exec-8] c.a.b.service.kobo.KoboServerProxy : Kobo proxy URL: https://storeapi.kobo.com

2025-11-26T19:32:52.724Z INFO 9 --- [booklore-api] [nio-8080-exec-8] c.a.b.service.kobo.KoboServerProxy : Kobo proxy response status: 401

FYI: If I try a different token I get the Access Denied error "Access to 192.168.14.35 was denied You don't have authorization to view this page. HTTP ERROR 403"

chiguirepower avatar Nov 26 '25 19:11 chiguirepower

I am getting the same in 1.12.0 proxy and direct IP, I changed my token as well to see if something hadn't been set but no change.

I also get below in my log as well even with the proxy settings for nginx as described in the documentation for the Kobo sync.

java.lang.IllegalArgumentException: Invalid character found in the request target [/api/kobo/(my private token)/v1/assets?DiffRequests=[%7BKey:EPD-KoboPlus-ReadOnly-NeverSubscribed,ETag:W/NjM4MjU4OTA5NzgwMDAwMDAwLTMwMjQ1%7D] ]. The valid characters are defined in RFC 7230 and RFC 3986

adamjeffery avatar Nov 26 '25 20:11 adamjeffery

These messages are harmless and won’t affect functionality:

java.lang.IllegalArgumentException: Invalid character found in the request target [/api/kobo/(my private token)/v1/assets?DiffRequests=[%7BKey:EPD-KoboPlus-ReadOnly-NeverSubscribed,ETag:W/NjM4MjU4OTA5NzgwMDAwMDAwLTMwMjQ1%7D] ]. The valid characters are defined in RFC 7230 and RFC 3986
Server log:
2025-11-26T19:32:52.606Z INFO 9 --- [booklore-api] [nio-8080-exec-8] c.a.b.service.kobo.KoboServerProxy : Kobo proxy URL: [storeapi.kobo.com](https://storeapi.kobo.com/)

acx10 avatar Nov 27 '25 00:11 acx10

These messages are harmless and won’t affect functionality:

java.lang.IllegalArgumentException: Invalid character found in the request target [/api/kobo/(my private token)/v1/assets?DiffRequests=[%7BKey:EPD-KoboPlus-ReadOnly-NeverSubscribed,ETag:W/NjM4MjU4OTA5NzgwMDAwMDAwLTMwMjQ1%7D] ]. The valid characters are defined in RFC 7230 and RFC 3986
Server log:
2025-11-26T19:32:52.606Z INFO 9 --- [booklore-api] [nio-8080-exec-8] c.a.b.service.kobo.KoboServerProxy : Kobo proxy URL: [storeapi.kobo.com](https://storeapi.kobo.com/)

@adityachandelgit Thanks for getting back here—I think the issue for me is that kobo sync never worked for me with Booklore, and this message was the only error message I was able to see that might be related. Kobo sync not working is the only issue I have that’s holding me back from actually using Booklore, keeping me on Calibre Web.

alecmekarzel avatar Nov 27 '25 08:11 alecmekarzel

I figured out my issue in that even with the nginx proxy configuration entries noted in the setup documentation there is something wrong in the nginx configuration I have (I use SWAG which is plain ngnix ), as if I put in the "api_endpoint" as the IP address and port of booklore it is working but not through the reverse proxy. I tried correcting my nginx configuration but wasn't able to get anything working as of yet. I think someone sharing a working subdomain configuration file will get a lot of people sorted, but I haven't got there myself.

adamjeffery avatar Nov 27 '25 14:11 adamjeffery

I think someone sharing a working subdomain configuration file will get a lot of people sorted, but I haven't got there myself.

Not nginx and so not sure how relevant but here is the relevant portion of my caddyfile that has been working without any issues for me.

# Caddy file for sending traffic to podman pods/containers
{
   acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}

*.mydomain.xyz {
    log {
        output file /data/traffic.log
    }
    tls {
        dns cloudflare {env.CLOUDFLARE_API_TOKEN}
    }

    # traffic hits this endpoint
    @books host books.mydomain.xyz

    # forwarded to my booklore pod
    reverse_proxy @books booklore-pod:6060 {
         flush_interval -1
    }

}

GianniBYoung avatar Nov 27 '25 18:11 GianniBYoung

I figured out my issue in that even with the nginx proxy configuration entries noted in the setup documentation there is something wrong in the nginx configuration I have (I use SWAG which is plain ngnix ), as if I put in the "api_endpoint" as the IP address and port of booklore it is working but not through the reverse proxy. I tried correcting my nginx configuration but wasn't able to get anything working as of yet. I think someone sharing a working subdomain configuration file will get a lot of people sorted, but I haven't got there myself.

This is my SWAG config that works. Hope that helps.

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name mysub.domain.com;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;


    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app Booklore;
        set $upstream_port 6060;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }

    location /api/kobo/ {
        include /config/nginx/resolver.conf;
        set $upstream_app Booklore;
        set $upstream_port 6060;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;

        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
    }
}

Jaonea avatar Nov 27 '25 19:11 Jaonea

I suspect the issue comes from missing Nginx buffer settings that are normally required for Booklore sync:

# Required buffer settings
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
large_client_header_buffers 8 32k;

Since I am using Zoraxy as my reverse proxy – and it does not expose or support these buffer directives – the sync request fails.

Is my assumption correct that the missing Nginx buffer config in Zoraxy is causing the sync failure?

knorrre avatar Dec 02 '25 10:12 knorrre

I am experiencing this issue without nginx and when I try to hit that URL from the same network.

PavelGutin avatar Dec 03 '25 00:12 PavelGutin