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

Sharing: Incorrect link redirect when installed on a shared domain #1617

Closed
v-bulynkin opened this issue Oct 12, 2021 · 15 comments
Closed

Sharing: Incorrect link redirect when installed on a shared domain #1617

v-bulynkin opened this issue Oct 12, 2021 · 15 comments
Assignees
Labels
bug Something isn't working released Available in the stable release

Comments

@v-bulynkin
Copy link

v-bulynkin commented Oct 12, 2021

I have a docker container of Photoprism with

PHOTOPRISM_SITE_URL: "http://docker/photo/"

It sits behind Traefik reverse-proxy:

 labels:
      - "traefik.enable=true"
      - "traefik.http.routers.photoprism.rule=PathPrefix(`/photo`)"

In the admin panel everything work correctly, but there is a problem with sharing links - I make a link where all seems good:

изображение

However, when I copy the link (http://docker/photo/s/2pk0fpqoyj/test) and try to open it in a browser, the link transforms to https://docker/s/2pk0fpqoyj/ar0uvkm1ei9j9uwc and I get 404 error:

изображение

If I manually add the prefix (https://docker/photo/s/2pk0fpqoyj/ar0uvkm1ei9j9uwc), it works.

Why the /photo prefix disappears and how to prevent this behaviour?
The same thing happens after exiting - it goes not to login page http://docker/photo but to the root http://docker

@lastzero
Copy link
Member

We'll take a look at this as soon as possible. It worked when I tested it the last time. Meanwhile, please look through GitHub issues as I remember we had similar issues that could be resolved by clearing the browser cache or changing the proxy configuration.

@v-bulynkin
Copy link
Author

Thank you for the response, found it: #425 (comment)

However, I can't figure out how to solve this in Traefik. I read that "Traefik handle websocket, and you don't need any specific configuration for this", and also found a middleware, which didn't help.

@lastzero
Copy link
Member

Traefik should automatically handle Websockets, that's one of the advantages. You shouldn't need a middleware, but also I'm not sure if using PathPrefix() has an impact here.

Installing PhotoPrism (and every other app) on a shared domain certainly complicates things, negatively impacts performance, and may also reduce security (see same origin policy). We've implemented this because people were asking for it, not because we recommend it or think it's easy to set up.

https://docs.photoprism.org/getting-started/faq/#can-i-install-photoprism-in-a-sub-directory-on-a-shared-domain

@v-bulynkin
Copy link
Author

Yes, I know and completely agree, but I don't have an option of using subdomains because I have been using free DynDNS for more than 5 years where I have only one domain name.
However, if we use containers, doesn't it the same as if we used all services in one web server? Containers are isolated from each other, isn't it better?

@lastzero
Copy link
Member

We're using DigitalOcean as dynamic DNS (free) and have a domain with wildcard cert from let's encrypt (also free). Only the domain costs a few bucks a year. Before you invest too much time in the shared domain config, that may be an option. Took 1 hour to set up.

Containers don't help with isolating browser sessions and client-side JavaScript. They also don't remove the browser resource limit per domain.

@lastzero
Copy link
Member

We mainly use containers because working with media files requires a ton of dependencies. Helping every user to set up every single tool properly and do remote debugging in case there are problems would kill the project in no time! 👯

@v-bulynkin
Copy link
Author

Thanks for the explanation! I will consider this option.
Nevertheless, if the possibility of working under shared domain URL is presented, it would be nice to have a complete working scheme...

@lastzero
Copy link
Member

We're super busy right now but doing our best to help! Not sure when we have time for testing as I have to focus on multi user support this and next week. If it's a bug on our side, we'll fix it 👍

@graciousgrey graciousgrey added the technical-support Support request label Oct 18, 2021
@lastzero lastzero changed the title If Photorpism is published by subpath, sharing links work incorrectly Sharing: Incorrect link redirect when installed on a shared domain Oct 27, 2021
@lastzero lastzero added needs-analysis Requires further investigation help wanted Well suited for external contributors! and removed technical-support Support request labels Oct 27, 2021
@lastzero lastzero self-assigned this Dec 14, 2021
@lastzero lastzero added bug Something isn't working and removed needs-analysis Requires further investigation help wanted Well suited for external contributors! labels Dec 14, 2021
@lastzero
Copy link
Member

Think I found & fixed it while improving request parameter sanitation 🤞

@lastzero lastzero added the please-test Ready for acceptance test label Dec 14, 2021
@v-bulynkin
Copy link
Author

Great news! But I can't verify this, because for unknown reason my Photoprism doesn't update. Instead of having the latest Docker image and following the update procedure, I still have the 211010-83b4f783 :(

@lastzero
Copy link
Member

Raspberry Pi? Make sure to use the right image name and tag:

@v-bulynkin
Copy link
Author

v-bulynkin commented Dec 16, 2021

No, it's perfectly usual x86_64 Celeron platform. This is my image of photoprism, but I wonder why my container (after docker image prune, kill/restart/deleting container) is still having the old version...

REPOSITORY              TAG        IMAGE ID       CREATED        SIZE
photoprism/photoprism   latest     f096af28aba5   28 hours ago   1.5GB

Sorry for the offtop, but I can't figure it out.

@lastzero
Copy link
Member

Did you explicitly pull? What does the pull command say?

@v-bulynkin
Copy link
Author

v-bulynkin commented Dec 16, 2021

$ docker pull photoprism/photoprism
Using default tag: latest
latest: Pulling from photoprism/photoprism
Digest: sha256:12f336c85dce05daab81e5e85bd73af228ed21cf4092882df988f8fcc20595bc
Status: Image is up to date for photoprism/photoprism:latest
docker.io/photoprism/photoprism:latest

After that

$ docker-compose stop photoprism
Stopping photoprism ... done
$ docker-compose up -d photoprism
photoprism-db is up-to-date
Starting photoprism ... done

But I still have the old version: https://bva.dyndns.info/photo/login

In the docker-compose.yml:

  photoprism:
    image: photoprism/photoprism
    container_name: photoprism
    depends_on:
      - photoprism-db
    restart: unless-stopped

@v-bulynkin
Copy link
Author

I deployed a new instance of Photoprism in k8s and confirm that the problem is solved.
Sharing links work correctly, transforming in the right way.
Thanks!

@lastzero lastzero added released Available in the stable release and removed please-test Ready for acceptance test labels Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in the stable release
Projects
Status: Release 🌈
Development

No branches or pull requests

3 participants