Code Monkey home page Code Monkey logo

Comments (8)

elmodor avatar elmodor commented on July 29, 2024 1

Awesome, that did the trick! Connecting and listening works :)

Thanks for the fast reply and implementation. Glad you noticed to set cleartextTrafficPermitted="true" tho.
After I saw how you did the implementation I looked at the other apps (e.g. jellyfin) and saw that they did the exact same thing.

from audiobookshelf-app.

advplyr avatar advplyr commented on July 29, 2024

Are you able to connect to the website on your phone and listen to an audiobook? The web doesn't require a socket connection to connect to the server, but it does require it to listen to an audiobook. The app requires it to connect.

On the socket.io website they have an example caddy config: https://socket.io/docs/v3/reverse-proxy/#caddy-2

I still need to add a page in the documentation for this, so if you solve the issue please follow up so I can add your solution.

from audiobookshelf-app.

elmodor avatar elmodor commented on July 29, 2024

Yes, I'm able to connect to the website on my phone (via https) and listen to an audiobook (tested on Firefox).

I think the certificate validation is the issue here.
I changed Caddy to proxy http (instead of https). And using the Caddy reverse proxy on http I can connect via the app. So the Caddyfile should be correct. When I change the proxy to https, it doesn't work (even when using some header_up properties).

The certificate on caddy is a self signed certificate from caddy itself, not one from let's encrypt or similar. However, the certificate is installed on my android device so the validation should still work.

from audiobookshelf-app.

advplyr avatar advplyr commented on July 29, 2024

What is throwing me off is that it works on the mobile browser, because the app is running the same code when it comes to making requests.
I did find one post with this same issue and the only response was to get a different certificate from LetsEncrypt or something. Working with self-signed certificates has always been a pain for me.

A lot of users have gotten this setup already over ssl, not with caddy specifically, but hopefully they can offer a better answer than I can.

from audiobookshelf-app.

elmodor avatar elmodor commented on July 29, 2024

Well firefox has it's own certificate storage. So it takes the validation from those instead from the android system.

So it probably is the self signed certificate. However, when added to the android trusted certificates, the app should be able to access those and validate my connection. Sadly I'm not really familiar how the implementation works. I just know that it does work on other apps (same certificate, and validations is successful). I was hoping that this would be something android would just do for you but it seems like it does. I can see why this is a pain to deal with.

It might be an option to add the option to skip the ssl validation / to accept "untrusted" certificates.
However, I would rather like my certificate to work, because it should be trusted.

from audiobookshelf-app.

elmodor avatar elmodor commented on July 29, 2024

This might be the issue:
According to
https://developer.android.com/training/articles/security-config#base-config
The default certification trust level is set to "system"

Defined via:
https://developer.android.com/training/articles/security-config#certificates

My certificate is added into the android system as "user" certificate.
Maybe something liek this could work:

<network-security-config>
    <base-config cleartextTrafficPermitted="false">
        <trust-anchors>
           <certificates src="system" />
           <certificates src="user" />
        </trust-anchors>
    </base-config>
</network-security-config>

I don't have any android development setup, so I can't test this sadly.

from audiobookshelf-app.

advplyr avatar advplyr commented on July 29, 2024

I included this in release v0.9.18-beta that will be available on the play store in an hour or so. Hopefully that works.

from audiobookshelf-app.

advplyr avatar advplyr commented on July 29, 2024

Nice! Good find on that config, had no idea about that.

from audiobookshelf-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.