- An HTTP server with a CORS configuration that allows unsecured HTTP connection is prone to exploits. -
-Make sure the connection to the origins is established over HTTPS.
-Instead of an insecure HTTP connection to the origin, such as in the example below:
- -set up SSL like this:
- -- An HTTP server with a CORS configuration that allows wildcard origins is insecure, as it allows connections - from any host. -
-Add explicit origins when configuring the CorsHandler.
Instead of adding a wildcard origin, such as in the example below:
- -define the origins explicitly like this:
- -- An HTTP server which does not use SSL/TLS is vulnerable to man-in-the-middle attacks. -
-- Please, note that it may be safe to ignore this, only if you intend your application to be placed - behind a loadbalancer, which is itself securing the connections with the appropriate certificates. -
-Use SSL/TLS to encrypt the communication between the client and the server.
-Instead of setting up a plain HTTP server that doesn't use SSL, such as this one:
- -
- when creating an HTTP server, the setSsl method should be called on the
- HttpServerOptions
- object, and the setKeyStoreOptions method should be called on the
- HttpServerOptions
- object with a KeyStoreOptions
- object as an argument.
-
- For example, code such as the one illustrated below should be used to create an HTTP server and secure
- it with SSL:
-