"Content-Type" in the response headers is always "application / octet-stream"

I have a simple installation of Node.js Express, the purpose of which is to provide the "apple-app-site-association" file required by Apple Universal Links.

My router is configured as follows (the rest of the application is omitted, standard Express material):

var express = require('express');
var router = express.Router();
var path = require('path');

var aasa = path.join(__dirname, '..', 'apple-app-site-association');

router.route('/apple-app-site-association')
    .get(function (req, res, next) {
        res.set('Content-Type', 'application/pkcs7-mime');
        res.status(200);
        res.sendFile(aasa);
    });

module.exports = router;

Now, if you run this on my local computer, everything is fine, the response headers that I get:

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/pkcs7-mime
Accept-Ranges: bytes
Date: Tue, 05 Jan 2016 21:12:32 GMT
Cache-Control: public, max-age=0
Last-Modified: Mon, 28 Dec 2015 16:22:31 GMT
ETag: W/"c2-3944605092"
Content-Length: 194
Connection: keep-alive

But if I run the same application on my remote server, I get the following response headers:

HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Date: Tue, 05 Jan 2016 21:13:46 GMT
Cache-Control: public, max-age=0
Last-Modified: Mon, 28 Dec 2015 16:22:31 GMT
ETag: W/"c2-3944605092"
Content-Type: application/octet-stream
Content-Length: 194
Connection: keep-alive

Somehow the Content-Type set is ignored and returns "application / octet-stream".

, ? Node.js(5.3.0) Express (4.13.3) . !

+4

Source: https://habr.com/ru/post/1622991/


All Articles