CORS Test server

Test server for CORS communication.

Setup

You should create an hostname for the server in your hosts.

notepad.exe "C:\Windows\System32\drivers\etc\hosts"
127.0.0.1	cors-test-server.local

Run genkey and set the common name to the host name

Common Name (e.g. server FQDN or YOUR name) []: cors-test-server.local

Start

node main.js

Test

curl -k https://cors-test-server.local:3000

Client integration

Aurelia fetch client

import {HttpClient} from 'aurelia-fetch-client';
import {autoinject} from 'aurelia-framework';

@autoinject()
class CorsClient {
    constructor(httpClient: HttpClient) {
        httpClient.configure(config => {
            config
                .useStandardConfiguration()
                .rejectErrorResponses()
                .withDefaults({
                    credentials: "include",
                    mode: "cors"
                });
        });
    }
}