gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API, OPDS and Kobo Sync support
https://komga.org
MIT License
4k stars 237 forks source link

Ebook was loaded over HTTPS #1326

Closed JamesDAdams closed 10 months ago

JamesDAdams commented 10 months ago

Steps to reproduce

Click to READ a e-book

Expected behavior

Be able to read the book

Actual behavior

with page and this error in log :

index.js:62874 Mixed Content: The page at 'https://komga.domain.com/book/06GB75S90JH57/read-epub' was loaded over HTTPS, but requested an insecure resource 'http://komga.domain.com/api/v1/books/06GB75S90JH57/resource/OPS/cover.xhtml'. This request has been blocked; the content must be served over HTTPS.

Logs

No response

Komga version

1.8.3

Operating system

Unraid

Installation method

Docker

Other details

No response

Acknowledgements

gotson commented 10 months ago

Can you share what reverse proxy configuration you are using?

gotson commented 10 months ago

Can you also get the content of https://komga.domain.com/api/v1/books/06GB75S90JH57/manifest ?

nx6 commented 10 months ago

Hello. I'm having this same issue. I can read manga fine, it's only an issue with the new eBooks reader.

Komga version: 1.8.3 Operating system: FreeBSD Installation method: jar

# Proxy for Komga

    location /manga {
        return 302 $scheme://$host/manga/;
    }

    location /manga/ {
        proxy_pass http://192.168.x.xxx:25600;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

I'm not having any luck with the Manifest thing you're asking for.

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Dec 05 05:14:13 GMT 2023 There was an unexpected error (type=Not Found, status=404). 404 NOT_FOUND

gotson commented 10 months ago

I believe you may be missing X-Forwarded-Proto in your reverse proxy configuration.

nx6 commented 10 months ago

Well that did change things. Instead of getting a blank page I got a little exclamation mark triangle instead. I didn't have an error referencing index.js:62874 and Mixed Content not loading like I was getting, similar to @JamesDAdams. Instead I now had:

Invalid X-Frame-Options header was found when loading “https://domain.tld/manga/api/v1/books/0EDB0YARZXJPM/resource/OPS/cover.xhtml”: “invalid” is not a valid directive.

I followed the Inspector's link to read up on the error, and added add_header X-Frame-Options SAMEORIGIN; to my config as well, and that seems to have fixed this issue for me. 👍

gotson commented 10 months ago

you probably have some other missing configuration in your reverse proxy if you need to add the X-Frame-Options, as it is already being returned by the backend.

Maybe your RP is filtering it, and thus it does not reach your browser.

gotson commented 10 months ago

I am using Caddy 2 myself, and it works outside the box. This is what Caddy is doing in reverse proxy:

It sets or augments the X-Forwarded-For header field. It sets the X-Forwarded-Proto header field. It sets the X-Forwarded-Host header field.

JamesDAdams commented 10 months ago

Well that did change things. Instead of getting a blank page I got a little exclamation mark triangle instead. I didn't have an error referencing index.js:62874 and Mixed Content not loading like I was getting, similar to @JamesDAdams. Instead I now had:

Invalid X-Frame-Options header was found when loading “https://domain.tld/manga/api/v1/books/0EDB0YARZXJPM/resource/OPS/cover.xhtml”: “invalid” is not a valid directive.

I followed the Inspector's link to read up on the error, and added add_header X-Frame-Options SAMEORIGIN; to my config as well, and that seems to have fixed this issue for me. 👍

I add add_header X-Frame-Options SAMEORIGIN; in my nginx proxy manager and it's doesn't work for me :/

Same for :

It sets or augments the X-Forwarded-For header field. It sets the X-Forwarded-Proto header field. It sets the X-Forwarded-Host header field.

JamesDAdams commented 10 months ago
image
JamesDAdams commented 10 months ago

I use Cloudfalre tunnel and if i redirect the tunnel directly on Komga container it's work, but i redirect all my tunnel to Nginx proxy manager and NPM redirect to my container