Improved the setting of the cors headers.