Cleaning up URIs, for fun

I didn’t like the /tt-rss/index.php part of my uris, so this is what I did.

I set SELF_URL_PATH to https://reader.mydomain.example, which wasn’t enough to make the enforcer happy. Then I did two things.

I configured my Caddy reverse proxy like this:

reader.mydomain.example {
        redir /index.php /
        rewrite * /tt-rss{uri}
        reverse_proxy localhost:8084 
}

And I added this in tt-rss config.d directory:

<?php
if (php_sapi_name() != "cli") {
    $_SERVER['REQUEST_URI'] = str_replace("/tt-rss", "", $_SERVER['REQUEST_URI']);
}

And suddenly, I was happy.

Yeah, I was an idiot. I didn’t have to hack it that way. I just had to use a docker-compose.override.yml and make my own copy of nginx.conf.

version: '3'
services:
  web-nginx:
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    healthcheck:
      test: ["CMD", "curl", "--fail", "http://localhost"]