angular6 http requests returns isTrusted
It seems like Nginx configuration issue.The following Nginx codes will add HTML header responses Access-Control-Allow-Origin: * : public web static files of domain to let other domains access these web static files without issues:
location / { location ~* ^.+\.(?:css|cur|json|js|jpeg|gif|htc|ico|png|txt|otf|ttf|eot|woff|svg|webp|webm|zip|gz|tar|rar)$ { # If request comes from allowed subdomain # (yourdomain.com) then we enable CORS # if ($http_origin ~* (https?://yourdomain\.com(:[0-9]+)?$)) { # set $cors "1"; # } set $cors "1"; # OPTIONS indicates a CORS pre-flight request if ($request_method = 'OPTIONS') { set $cors "${cors}o"; } # Append CORS headers to any request from # allowed CORS domain, except OPTIONS if ($cors = "1") { more_set_headers 'Access-Control-Allow-Origin: $http_origin'; more_set_headers 'Access-Control-Allow-Credentials: true'; } # OPTIONS (pre-flight) request from allowed # CORS domain. return response directly if ($cors = "1o") { more_set_headers 'Access-Control-Allow-Origin: $http_origin'; more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE'; more_set_headers 'Access-Control-Allow-Credentials: true'; more_set_headers 'Access-Control-Allow-Headers: Origin,Content-Type,Accept'; add_header Content-Length 0; add_header Content-Type text/plain; return 204; } }}
I think, this will solve the problem. In json file, please update the assets property to include an 'array' instead of 'string'.
It an issue with Angular CLI beta versions vs stable releases.
"apps": [ { "root": "src", "outDir": "dist", "assets": "assets" }] "apps": [ { "root": "src", "outDir": "dist", "assets": [ "assets" ] }]