How to change the redirect to /tt-rss/ from 302 to 301

  • [x ] I’m using docker compose setup, with modifications (modified .yml files, third party plugins/themes, etc.) - if so, describe your modifications in your post. Before reporting, see if your issue can be reproduced on the unmodified setup.

The redirect from example.com to example.com/tt-rss is currently 302 and I would like it to be 301

I’m using Apache with the following .htaccess file

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  • Tiny Tiny RSS version (including git commit id): v22.10-68dee45
  • Platform (i.e. Linux distro, Docker, PHP, PostgreSQL, etc) versions:
    Synology NAS and Docker
>>> http://rss.*****.com
> --------------------------------------------
> 301 Moved Permanently
> --------------------------------------------
Status: 301 Moved Permanently
Code:   301
Server: nginx
Date:   Wed, 05 Oct 2022 12:14:02 GMT
Content-Type:   text/html; charset=iso-8859-1
Content-Length: 231
Connection: close
Location:   https://rss.*****.com/

>>> https://rss.******.com/
> --------------------------------------------
> 302 Found
> --------------------------------------------
Status: 302 Found
Code:   302
Server: nginx
Date:   Wed, 05 Oct 2022 12:14:03 GMT
Content-Type:   text/html; charset=UTF-8
Connection: close
X-Powered-By:   PHP/8.1.11
Location:   /tt-rss/
Strict-Transport-Security:  max-age=15768000; includeSubdomains; preload

>>> /tt-rss/
> --------------------------------------------
> 200 OK
> --------------------------------------------
Status: 200 OK
Code:   200
Server: nginx
Date:   Wed, 05 Oct 2022 12:14:03 GMT
Content-Type:   text/html; charset=UTF-8
Connection: close
X-Powered-By:   PHP/8.1.11
Cache-Control:  public
Strict-Transport-Security:  max-age=15768000; includeSubdomains; preload

you can set whatever redirect using your apache (who uses apache anymore? jesus christ) frontend
alternatively adjust index.php in the base container to your liking and rebuild

You’re probably going to throw something at me but there is no frontend to Apache on a Synology box, all I have is the root folder where I can add a .htaccess file. The file I’m using can handle the http → https request with a 301 redirect, it’s the subsequent redirect to /tt-rss/ that is causing me the issue. Do you think if i try and do it through htaccess I’ll have 2 redirects competing with each other?

I’ve researched this to death but fully expecting my novice questions to get me thrown in the sin bin :slight_smile:

#for all requests to rss.*****.com
RewriteCond %{HTTP_HOST} ^rss.*****\.com$
#redirect them to rss.*****.com
RewriteRule (.*) https://rss.********.com/$1 [R=301,L]

This is really frustrating, every single redirect is using 301 apart from the redirect from rss..com to rss.*.com/tt-rss/ which stays as 302

At the very least I have perseverance
I’ve installed Nginx Proxy Manager and by-passed the internal Apache/Nginx of my Synology NAS
Setting up a proxy host for rss..com to 192.168.2.20:8200 gives me the same issue, the redirect from rss..com to rss.*****.com/tt-rss/ is with 302
I then deleted this and set up a redirection host

The good news is the redirects are 301 but it’s created a loop.

I feel I’m really close and any help would be appreciated

I’ve read that a redirect defaults to 302 in php and you have to specifically state if you want it to use a different code

image

If I were to change this to state 301 would it solve my issues?
image

Presumably this would be overwritten every time there was a change?

Changing this line to header("Location: /tt-rss/", true, 301); now shows a 301 redirect. I’ve set up a scheduled job to replace the index.php straight after watchtower finishes updating on the presumption any new pull will overwrite my change.

If it’s not a daft question, shouldn’t this explicitly use a 301 redirect when 302 should be used for temporary changes?

Thanks for your patience

Serious question: Why do you care? I know 301 and 302 are semantically different, but what’s the client behavior you want that happens with 301 but not 302?

i’ve seen many weird things, but seeing someone obsess so much over http status codes is a first.

p.s. no, i’m not going to change anything.

Haha, believe you me I wouldn’t be looking into all this unless I had to
A few days ago my domain was flagged by Google as “deceptive site ahead” and this would be seen for any subdomain I had. I received an alert to say the address rss.*****.com had Social Engineering Content and I could submit it for review once the issue was sorted
image
Google give you no help whatsoever on what the issue may be so I’ve been looking into all sorts. I had a look through Google’s forums and came across this


which suggests having a 302 redirect to a login page can cause the issue. That’s what started all the fun since.

No problem if you’re not going to change the redirect, I’ll deal with it at my end. Thanks for taking the time to respond. I have a number of subdomains and it was only rss.****.com that was flagged so I knew it was something related to tt-rss

I don’t think Google is so completely detached from reality they consider http 301 somehow deceptive but I wouldn’t be all that surprised if they do.

I don’t need American megacorps to tell me which sites are bad for me so I’m not going to change anything even if it’s true.