2024-10-29 14:51:49 +00:00
# Immich Public Proxy
2024-11-14 12:38:32 +00:00
< p align = "center" width = "100%" >
2024-11-19 10:20:16 +00:00
< a href = "https://hub.docker.com/r/alangrainger/immich-public-proxy/tags" >
2024-12-26 22:27:28 +00:00
< img alt = "Docker pulls" src = "https://badgen.net/docker/pulls/alangrainger/immich-public-proxy?v1.5.5&icon=docker&label=docker%20pulls&color=green&scale=1.1" > < / a >
2024-11-19 10:20:16 +00:00
< a href = "https://github.com/alangrainger/immich-public-proxy/releases/latest" >
2024-12-26 22:27:28 +00:00
< img alt = "Latest release" src = "https://badgen.net/static/release/v1.5.5/blue?scale=1.1" > < / a >
2024-12-18 21:01:33 +00:00
< a href = "https://immich-demo.note.sx/share/gJfs8l4LcJJrBUpjhMnDoKXFt1Tm5vKXPbXl8BgwPtLtEBCOOObqbQdV5i0oun5hZjQ" > < img alt = "Open demo gallery" src = "https://badgen.net/static/↗🖼️/live%20demo/green?scale=1.1" > < / a >
2024-11-14 12:38:32 +00:00
< / p >
2024-11-14 12:32:41 +00:00
2024-11-15 15:15:31 +00:00
Share your Immich photos and albums in a safe way without exposing your Immich instance to the public.
2024-11-04 11:04:52 +00:00
2024-11-08 15:09:16 +00:00
Setup takes less than a minute, and you never need to touch it again as all of your sharing stays managed within Immich.
2024-10-29 18:57:44 +00:00
2024-10-29 15:31:21 +00:00
< p align = "center" width = "100%" >
2024-11-14 13:46:17 +00:00
< img src = "docs/ipp.svg" width = "200" height = "200" >
2024-10-29 15:31:21 +00:00
< / p >
2024-10-31 13:32:50 +00:00
### Table of Contents
2024-10-31 13:30:26 +00:00
2024-10-31 13:31:17 +00:00
- [About this project ](#about-this-project )
2024-12-27 01:09:19 +00:00
- [Installation ](#installation )
- [Install with Docker ](#install-with-docker--podman )
- [Install with Kubernetes ](docs/kubernetes.md )
2024-11-01 05:57:08 +00:00
- [How to use it ](#how-to-use-it )
2024-10-31 13:30:26 +00:00
- [How it works ](#how-it-works )
2024-11-01 14:36:53 +00:00
- [Additional configuration ](#additional-configuration )
2024-11-11 12:51:14 +00:00
- [Troubleshooting ](#troubleshooting )
2024-10-31 13:30:26 +00:00
- [Feature requests ](#feature-requests )
## About this project
2024-11-02 07:59:36 +00:00
[Immich ](https://github.com/immich-app/immich ) is a wonderful bit of software, but since it holds all your private photos it's
best to keep it fully locked down. This presents a problem when you want to share a photo or a gallery with someone.
2024-10-29 14:51:49 +00:00
2024-10-30 10:25:36 +00:00
**Immich Public Proxy** provides a barrier of security between the public and Immich, and _only_ allows through requests
2024-11-02 07:59:36 +00:00
which you have publicly shared.
2024-10-29 14:51:49 +00:00
2024-11-02 07:59:36 +00:00
It is stateless and does not know anything about your Immich instance. It does not require an API key which reduces the attack
surface even further. The only things that the proxy can access are photos that you have made publicly available in Immich.
2024-11-01 13:45:25 +00:00
2024-12-18 21:01:33 +00:00
See a [Live demo gallery ](https://immich-demo.note.sx/share/gJfs8l4LcJJrBUpjhMnDoKXFt1Tm5vKXPbXl8BgwPtLtEBCOOObqbQdV5i0oun5hZjQ )
2024-11-15 12:59:01 +00:00
serving straight out of my own Immich instance.
2024-11-12 09:06:16 +00:00
2024-11-01 11:22:38 +00:00
### Features
- Supports sharing photos and videos.
- Supports password-protected shares.
2024-11-12 09:38:32 +00:00
- If sharing a single image, by default the link will directly open the image file so that you can embed it anywhere you would a normal image. (This is configurable.)
2024-11-01 11:22:38 +00:00
- All usage happens through Immich - you won't need to touch this app after the initial configuration.
2024-10-29 14:51:49 +00:00
2024-10-31 06:53:56 +00:00
### Why not simply put Immich behind a reverse proxy and only expose the `/share/` path to the public?
To view a shared album in Immich, you need access to the `/api/` path. If you're sharing a gallery with the public, you need
2024-10-31 11:10:47 +00:00
to make that path public. Any existing or future vulnerability has the potential to compromise your Immich instance.
2024-10-31 06:53:56 +00:00
2024-10-31 11:10:47 +00:00
For me, the ideal setup is to have Immich secured privately behind mTLS or VPN, and only allow public access to Immich Public Proxy.
2024-10-31 12:03:33 +00:00
Here is an example setup for [securing Immich behind mTLS ](./docs/securing-immich-with-mtls.md ) using Caddy.
2024-10-29 19:00:41 +00:00
2024-11-17 15:26:40 +00:00
## Installation
2024-10-29 14:51:49 +00:00
2024-12-27 01:09:19 +00:00
### Install with Docker / Podman
2024-10-31 12:51:06 +00:00
1. Download the [docker-compose.yml ](https://github.com/alangrainger/immich-public-proxy/blob/main/docker-compose.yml ) file.
2024-10-29 14:51:49 +00:00
2024-11-04 19:23:34 +00:00
2. Update the value for `IMMICH_URL` in your docker-compose file to point to your local URL for Immich. This should not be a public URL.
2024-10-29 14:51:49 +00:00
2024-11-13 20:02:00 +00:00
3. Start the docker container. You can test that it is working by visiting `https://your-proxy-url.com/healthcheck` .
2024-11-13 20:01:09 +00:00
Check the container console output for any error messages.
2024-10-29 14:51:49 +00:00
```bash
docker-compose up -d
```
2024-11-03 16:18:56 +00:00
4. Set the "External domain" in your Immich **Server Settings** to be whatever domain you use to publicly serve Immich Public Proxy:
2024-10-29 14:51:49 +00:00
2024-11-01 13:45:25 +00:00
< img src = "docs/server-settings.png" width = "400" height = "182" >
2024-10-29 14:51:49 +00:00
2024-11-12 09:38:32 +00:00
Now whenever you share an image or gallery through Immich, it will automatically create the correct public path for you.
2024-10-30 10:20:51 +00:00
2024-11-19 19:18:17 +00:00
🚨 **IMPORTANT** : If you're using Cloudflare, please make sure to set your `/share/video/*` path to Bypass Cache, otherwise you may
run into video playback issues. See [Troubleshooting ](#troubleshooting ) for more information.
2024-12-27 01:09:19 +00:00
#### Running on a single domain
2024-11-17 15:26:40 +00:00
Because all IPP paths are under `/share/...` , you can run Immich Public Proxy and Immich on the same domain.
See the instructions here: [Running on a single domain ](./docs/running-on-single-domain.md ).
2024-12-27 01:09:19 +00:00
### Install with Kubernetes
[See the docs here ](docs/kubernetes.md ).
2024-11-01 05:57:08 +00:00
## How to use it
Other than the initial configuration above, everything else is managed through Immich.
2024-10-30 13:15:14 +00:00
You share your photos/videos as normal through Immich. Because you have set the **External domain** in Immich settings
2024-11-01 13:45:25 +00:00
to be the URL for your proxy app, the links that Immich generates will automaticaly have the correct URL:
2024-11-01 14:36:53 +00:00
< img src = "docs/share-link.webp" width = "751" height = "524" >
2024-10-30 13:15:14 +00:00
2024-11-01 05:57:08 +00:00
## How it works
2024-10-30 13:15:14 +00:00
When the proxy receives a request, it will come as a link like this:
```
https://your-proxy-url.com/share/ffSw63qnIYMtpmg0RNvOui0Dpio7BbxsObjvH8YZaobIjIAzl5n7zTX5d6EDHdOYEvo
```
2024-10-31 06:09:11 +00:00
The part after `/share/` is Immich's shared link public ID (called the `key` [in the docs ](https://immich.app/docs/api/get-my-shared-link )).
2024-10-30 13:15:14 +00:00
2024-10-31 06:53:56 +00:00
**Immich Public Proxy** takes that key and makes an API call to your Immich instance over your local network, to ask what
2024-10-30 13:15:14 +00:00
photos or videos are shared in that share URL.
2024-10-31 06:53:56 +00:00
If it is a valid share URL, the proxy fetches just those assets via local API and returns them to the visitor as an
2024-10-30 13:15:14 +00:00
individual image or gallery.
2024-10-31 06:09:11 +00:00
If the shared link has expired or any of the assets have been put in the Immich trash, it will not return those.
2024-10-30 13:15:14 +00:00
2024-11-11 15:43:02 +00:00
All incoming data is validated and sanitised, and anything unexpected is simply dropped with a 404.
2024-11-01 14:36:53 +00:00
## Additional configuration
2024-10-30 10:20:51 +00:00
2024-11-04 19:23:34 +00:00
There are some additional configuration options you can change, for example the way the gallery is set up.
2024-10-30 10:20:51 +00:00
2024-11-02 21:57:32 +00:00
1. Make a copy of [config.json ](https://github.com/alangrainger/immich-public-proxy/blob/main/app/config.json ) in the same folder as your `docker-compose.yml` .
2024-10-30 10:20:51 +00:00
2024-11-01 14:36:53 +00:00
2. Pass the config to your docker container by adding a volume like this:
2024-10-30 10:20:51 +00:00
2024-11-01 14:36:53 +00:00
```yaml
volumes:
- ./config.json:/app/config.json:ro
2024-10-30 10:20:51 +00:00
```
2024-11-01 14:36:53 +00:00
3. Restart your container and your custom configuration should be active.
2024-10-30 10:20:51 +00:00
2024-11-12 17:46:29 +00:00
### Immich Public Proxy options
| Option | Description |
|-------------------------|-----------------------------------------------------------------------------------------------------------------------------|
2024-11-17 08:09:34 +00:00
| `responseHeaders` | Change the headers sent with your web responses. By default there is `cache-control` and CORS added. |
2024-11-12 17:46:29 +00:00
| `downloadOriginalPhoto` | Set to `false` if you only want people to be able to download the 'preview' quality photo, rather than your original photo. |
2024-11-15 14:54:19 +00:00
| `showGalleryTitle` | Show a title on the gallery page. |
| `allowDownloadAll` | Allow visitors to download all files as a zip. |
2024-11-12 17:46:29 +00:00
2024-11-04 19:23:34 +00:00
### lightGallery
The gallery is created using [lightGallery ](https://github.com/sachinchoolur/lightGallery ).
2024-11-01 14:36:53 +00:00
You can find all of lightGallery's settings here:
2024-10-30 10:20:51 +00:00
https://www.lightgalleryjs.com/docs/settings/
2024-10-30 14:31:41 +00:00
2024-11-04 19:23:34 +00:00
For example, to disable the download button for images, you would edit the `lightGallery` section and change `download` to `false` :
2024-11-01 14:36:53 +00:00
```json
{
"lightGallery": {
"controls": true,
"download": false,
"mobileSettings": {
"controls": false,
"showCloseIcon": true,
"download": false
}
}
}
```
2024-11-11 12:51:14 +00:00
## Troubleshooting
2024-11-19 19:02:57 +00:00
If you're using Cloudflare and having issues with videos not playing well, make sure your `/share/video/` paths are set to bypass cache.
2024-11-11 12:51:14 +00:00
I ran into this issue myself, and found [some helpful advice here ](https://community.cloudflare.com/t/mp4-wont-load-in-safari-using-cloudflare/10587/48 ).
2024-11-19 19:10:26 +00:00
< a href = "docs/cloudflare-video-cache.webp" > < img src = "docs/cloudflare-video-cache.webp" style = "width:70%" > < / a >
2024-10-30 14:31:41 +00:00
## Feature requests
You can [add feature requests here ](https://github.com/alangrainger/immich-public-proxy/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop ),
2024-10-31 06:53:56 +00:00
however my goal with this project is to keep it as lean as possible.
2024-10-30 15:42:34 +00:00
Due to the sensitivity of data contained within Immich, I want anyone with a bit of coding knowledge
to be able to read this codebase and fully understand everything it is doing.
2024-11-13 13:28:49 +00:00
2024-11-13 13:29:40 +00:00
Things that not be considered for this project are:
2024-11-13 13:28:49 +00:00
- Anything that modifies Immich or its files in any way. If it requires an API key or privileged accesss, it won't be considered as a new feature.
2024-11-13 13:29:40 +00:00
- Uploading photos (see above).