Apache 2.2 Present rss http 410 pages as application/rss+xml content type

Posted by Mark Bakker on Server Fault See other posts from Server Fault or by Mark Bakker
Published on 2012-09-17T08:50:40Z Indexed on 2012/09/17 9:40 UTC
Read the original article Hit count: 478

Filed under:

I have a problem sending http-410 for very old rss feeds. Functional this can happen in one

  1. Very old rss feeds where content is not updated anymore / subject could not move to another feed
  2. Migration from 3th party site to our site where the rss feed is not longer functional supported

I tried several things in my site config see below;

<VirtualHost *:80>

        DocumentRoot /opt/tomcat/webapps/ROOT/
        ErrorDocument 500 /error/static/error-500.html
        ErrorDocument 503 /error/static/error-500.html
        ErrorDocument 404 /error/static/rss/error-404.html
        ErrorDocument 410 /error/static/rss/error-410.html

        # When error pages need to be served by apache,
        # exclude the files to serve as below (in comment)
        SetEnvIf Request_URI "/error/static/*" no-jk


# force all files to be image/gif:
<Location *.rss>
#<Location *>
#ForceType application/rss+xml
</Location>
#AddType application/rss+xml .rss
#AddType application/rss+xml .xml
#AddType application/rss+xml .html


        JkMount /* rss;use_server_errors=402
#        JkMount /* rss

        RewriteEngine on


        JkMount /news.rss rss
        JkMount /documenten-en-publicaties.rss rss

        RewriteEngine on

        RewriteRule ^/news.rss$ - [NC,T=application/rss+xml,G,L]
        RewriteRule ^/documenten-en-publicaties.rss$ - [NC,G,L]

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        ErrorLog "|/usr/bin/logger -s -p local3.err  -t 'Apache'"
        CustomLog "|/usr/bin/logger -s -p local2.info  -t 'Apache'" combined
        ServerSignature Off
</VirtualHost>

The desired end result should be on /news.rss and /documenten-en-publicaties.rss a 410 page with content in the error page with a content type 'application/rss+xml'

© Server Fault or respective owner

Related posts about apache2