Jellyfin Forum
Use proxy server for some metadata providers - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Guides, Walkthroughs & Tutorials (https://forum.jellyfin.org/f-guides-walkthroughs-tutorials)
+--- Thread: Use proxy server for some metadata providers (/t-use-proxy-server-for-some-metadata-providers)



Use proxy server for some metadata providers - omgiafs - 2024-04-13

Short answer: use proxy for blocked/blocking domains.

Solution is to make Jellyfin work with proxy server, but only for some domains like themoviedb.org, for example. It can be done easily using new generation proxy-servers like Xray. This proxy have many options like routing, that's exactly we need to use.

How it works:
Jellyfin <-> xray client <-> xray_server <-> "unrestricted" Internet

How to install Xray: https://github.com/XTLS/Xray-install
Of course you must have a VPN server with IP-address which have unrestricted access to metadata server.

Let's assume that we have xray proxy client on the same machine with Jellyfin. Client configuration file example:

$ cat /usr/local/etc/xray/client.json
Code:
// https://github.com/XTLS/Xray-examples/blob/main/Shadowsocks-2022/README.ENG.md
{
  "log":{
      "loglevel":"warning",
      "access":"none"
  },
  "routing":{
      "domainStrategy":"AsIs",
      "domainMatcher":"hybrid",
      "rules":[
        {
            "domainMatcher":"hybrid",
            "type":"field",
            "domain":[
              "domain:kinopoiskapiunofficial.tech",
              "domain:kinopoisk.dev"
            ],
            "outboundTag":"direct"
        },
        {
            "domainMatcher":"hybrid",
            "type":"field",
            "domain":[
              "domain:fanart.tv",
              "domain:musicbrainz.org",
              "domain:mb3admin.com",
              "domain:opensubtitles.com",
              "domain:opensubtitles.org",
              "domain:theaudiodb.com",
              "domain:themoviedb.org",
              "domain:thetvdb.com",
              "domain:tmdb.org",
              "domain:tvmaze.com"
            ],
            "outboundTag":"proxy"
        }
      ],
      "balancers":[
      ]
  },
  "inbounds":[
      {
        "port":1084,
        "protocol":"socks",
        "settings":{
            "udp":true
        }
      },
      {
        "port":1085,
        "protocol":"http"
      }
  ],
  "outbounds":[
      {
        "protocol":"shadowsocks",
        "tag":"proxy",
        "settings":{
            "servers":[
              {
                  "address":"PROXY_SERVER_ADDRESS",
                  "port":1080,
                  "method":"2022-blake3-aes-128-gcm",
                  "password":"HACKMEDIRTYHACKER"
              }
            ]
        }
      },
      {
        "protocol":"freedom",
        "tag":"direct"
      },
      {
        "protocol":"blackhole",
        "tag":"block"
      }
  ]
}

In this case xray client supports inbound connections using SOCKS protocol on 0.0.0.0:1084 and HTTP protocol on 0.0.0.0:1085.

Outbounds (named by "tags") are:
- "proxy" with our VPN server address, connection using SHADOWSOCKS-2022 protocol.
- "direct" without any routing. Just direct connection.
- "block". All traffic routed here just dropped.

Routing rules:
- Use "direct" outbound explicitly for domains and subdomains of kinopoiskapiunofficial.tech, kinopoisk.dev
- Use "proxy" outbound explicitly for domains and subdomains of fanart.tv, musicbrainz.org, mb3admin.com, opensubtitles.com, opensubtitles.org, theaudiodb.com, themoviedb.org, thetvdb.com, tmdb.org, tvmaze.com

Next and the last step is to edit Jellyfin systemd service for adding environment variables http_proxy and https_proxy:

$ sudo systemctl edit jellyfin.service
Code:
### Editing /etc/systemd/system/jellyfin.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file

[Service]
Environment=http_proxy=http://127.0.0.1:1085
Environment=https_proxy=http://127.0.0.1:1085

### Lines below this comment will be discarded


Restarting Jellyfin service:
$ sudo systemctl restart jellyfin.service

And voila, all metadata providers works like a charm  Upside-down-face