The solution I have found to this is:
To invent a file extension for the file, so traffic-advice
is renamed to traffic-advice.ta-json
(an invented file extension ... traffic advice JSON)
Use .htaccess to rewrite requests for traffic-advice
to traffic-advice.ta-json
And again in .htaccess, use AddType
to set the required MIME type for ta-json
files
.htaccess
therefore includes:
<IfModule mod_mime.c>
AddType application/trafficadvice+json ta-json
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^\.well-known/traffic-advice$ .well-known/traffic-advice.ta-json [PT]
# continues with other RewriteRules
</IfModule>
The traffic-response
file lives in .well-known
, only it's renamed with my 'invented' file extension to act as the trigger for setting the MIME type.
In Chrome and Firefox I can now see in the response header:
content-type: application/trafficadvice+json