Code Monkey home page Code Monkey logo

Comments (10)

qcasey avatar qcasey commented on May 17, 2024 1

Great!

The app must be adding the slash back in before making a connection attempt

Yep exactly, the app adds /api/[whatever], making the invalid request look like https://abc.example.org/scan//api/[whatever]

var response = await dio.get(baseURL + "/api/documents/");

from paperless_app.

qcasey avatar qcasey commented on May 17, 2024

Thank you for the detailed report!

I'm on mobile now, but I think this has to do with the validation that determines which paperless server to use.

return status == 405 || status == 404;

I'll help with this once I'm back at the desk.

from paperless_app.

qcasey avatar qcasey commented on May 17, 2024

Could you share your reverse proxy directive?

from paperless_app.

philbradley avatar philbradley commented on May 17, 2024

Sure thing. The relevant part of the Caddyfile is as follows:

abc.example.org {
reverse_proxy /* someotherphotohostingservice:2342
reverse_proxy /scan/* paperless_webserver_1:8000
reverse_proxy /rss/* http://rssaggregator-docker_web-nginx_1
}

This configuration makes Caddy automatically get an SSL certificate from Let's Encrypt for the domain (which is not actually abc.example.org, of course). It's using the DNS challenge for this, since my server isn't addressable from outside the LAN (except via VPN).

The other thing to note is that the paperless-ng postgres database is running on a nonstandard port (I was getting weird authentication errors when it was running on the same port as the postgres container for my self-hosted RSS aggregator. At some point I might make them use the same postgres instance, but for now they're distinct containers on distinct ports.

So my docker-compose.env is:
PAPERLESS_FORCE_SCRIPT_NAME=/scan PAPERLESS_DBPORT=5430

And the relevant part of my docker-compose.yml is:
environment: POSTGRES_DB: paperless POSTGRES_USER: paperlessuser POSTGRES_PASSWORD: paperlesspassword command: -p 5430

from paperless_app.

qcasey avatar qcasey commented on May 17, 2024

That's excellent, thanks. I was trying all kinds of url rewrite and header tricks when PAPERLESS_FORCE_SCRIPT_NAME=/scan is what I needed to get it working.

I'm seeing the same error you are when there's a trailing slash in the URL field.

  • https://abc.example.org/scan/ fails while
  • https://abc.example.org/scan logs in correctly

This is a bug in how baseURL is handled, I'll create a PR later to fix this so either variation of the above should work.

When you get a min, could you confirm if dropping the trailing slash works for you?

EDIT: I knew this sounded familiar...

from paperless_app.

philbradley avatar philbradley commented on May 17, 2024

Dropping the slash works perfectly. The app must be adding the slash back in before making a connection attempt, because /scan is not a valid paperless-ng address on my server - it gets handled under my reverse proxy's /* redirect rule.

from paperless_app.

philbradley avatar philbradley commented on May 17, 2024

I can understand why it would do so, because the Paperless-NG documentation instructs you to leave out the trailing slash when hosting at a subpath ("To host paperless under a subpath url like example.com/paperless you set this value to /paperless. No trailing slash!") . That's what I've done in the paperless-ng config, but my Caddyfile redirect does include the trailing slash (omitting it didn't seem to work). Maybe it should check whether the baseURL includes a trailing slash, and only include one if it's missing?

EDIT: you beat me to it!

from paperless_app.

qcasey avatar qcasey commented on May 17, 2024

IIRC an nginx proxy requires the same thing to work also, no big deal :)

This fix will be included in the next release. Thanks for your help!

from paperless_app.

siddharthdevilz avatar siddharthdevilz commented on May 17, 2024

Hi,

I'm still having the same issue.

My server is running at https://paperless.domainname.com behind a Traefik reverse proxy

from paperless_app.

philbradley avatar philbradley commented on May 17, 2024

The app available through app stores hasn't been updated yet, so you have to make sure there's no trailing slash in the server URL configured in the app. Next time the app updates, the underlying issue should be fixed.

from paperless_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.