Which MIME type is correct for the .exe file?

application/vnd.microsoft.portable-executable is a registered MIME type and its description matches what you want to use it for. The x- prefix in application/x-msdownload indicates that it is experimental so it should generally be avoided: Especially if something standard is available as it in in this case. application/octet-stream is for arbitary collections of bytes. It does match … Read more

Express.js – How to set a header to all responses

Just use a middleware statement that executes for all routes: // a middleware with no mount path; gets executed for every request to the app app.use(function(req, res, next) { res.setHeader(‘charset’, ‘utf-8’) next(); }); And, make sure this is registered before any routes that you want it to apply to: app.use(…); app.get(‘/index.html’, …); Express middleware documentation … Read more

Apache: difference between “Header always set” and “Header set”?

What is the difference between Header always set and Header set in Apache? As the quoted bit from the manual says, without ‘always’ your additions will only go out on succesful responses. But this also includes “successfully” forward errors via mod_proxy and perhaps other similar handlers that roughly act like proxies. What generates your 404s … Read more

Header parameters: “Accept” and “Content-type” in a REST context

The difference can be found in the specifications, in this case RFC 7231: 5.3.2. Accept The “Accept” header field can be used by user agents to specify response media types that are acceptable. 3.1.1.5. Content-Type The “Content-Type” header field indicates the media type of the associated representation The Accept header always indicates what kind of … Read more

How to add a response header on nginx when using proxy_pass?

add_header works as well with proxy_pass as without. I just today set up a configuration where I’ve used exactly that directive. I have to admit though that I’ve struggled as well setting this up without exactly recalling the reason, though. Right now I have a working configuration and it contains the following (among others): server … Read more

What’s the de facto standard for a Reverse Proxy to tell the backend SSL is used?

The proxy can add extra (or overwrite) headers to requests it receives and passes through to the back-end. These can be used to communicate information to the back-end. So far I’ve seen a couple used for forcing the use of https in URL scheme: X-Forwarded-Protocol: https X-Forwarded-Ssl: on X-Url-Scheme: https And wikipedia also mentions: # … Read more

Spring Global CORS configuration not working but Controller level config does

In order for the global CORS config to work, the client must add these two headers in the OPTIONS request. Origin: http://host.com Access-Control-Request-Method: POST However the @CrossOrigin annotation requires just the “Origin” header. Your client probably adds the “Origin” header but is missing the “Access-Control-Request-Method”…..thats why it works for you with the @CrossOrigin, but doesn’t … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)