Can I set SELF_URL_PATH with two domains?

As title, is it possible / workaround to set “SELF_URL_PATH” with two domains?
(eg: rss.one.com and rss.two.com)
Thanks.

you can, but it’s going to be convoluted. you’ll need to write a php if-else block in config.php which would set Config::SELF_URL_PATH based on whatever is inside $_SERVER[‘HTTP_HOST’] or something like that.

Read through these for further clues…

https://community.tt-rss.org/t/how-to-set-self-url-path-without-proper-loopback-on-internet-box/3967

https://community.tt-rss.org/t/skip-self-url-path-checks-was-removed/4589

.

Is this work with docker-compose setup?
I defined the SELF_URL_PATH in .env
Thanks.

if you read the posts linked to you, you’ll easily figure out why .env approach won’t work.

I added this file “ttrss-docker-compose/config.d/TTRSS_SELF_URL_PATH.php”

if ($_SERVER[‘HTTP_HOST’] == ‘rss.one.ml’){
putenv(‘TTRSS_SELF_URL_PATH=https://rss.one.ml/tt-rss’);
}else{
putenv(‘TTRSS_SELF_URL_PATH=https://rss.two.ml/tt-rss’);
}

But seems to not working, any advise ,thank for your help.

I found a workaround for my case, since I use nginx as a reverse proxy, I set the “proxy_set_header Host rss.one.site” and “proxy_set_header X-Forwarded-Host rss.one.site”.
Then it work for me.

server {
    listen      443 ssl http2;
    server_name rss.two.site;

  
    include rss.two.site-ssl;

    location / {
        proxy_pass http://172.18.0.1:8280/;
        proxy_http_version 1.1;
        proxy_set_header Host "rss.one.site";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host "rss.one.site";
        proxy_set_header X-Forwarded-Port $server_port;
    }
}

This seems to work fine:

    if (isset($_SERVER['HTTP_HOST'])) {
        putenv('TTRSS_SELF_URL_PATH=http://' . $_SERVER['HTTP_HOST'] );
    } else {
        putenv('TTRSS_SELF_URL_PATH=http://tt-rss.example.com');
    }

It worked fine without it but after upgrade my RSS feeds now showed that stupid warning about accessing the wrong domain (I have 2 domains coz one is proxied from outside via VPN and one is direct LAN access) when reading aggregated rss feed from tt-rss on my podcast reader