Angular-Full-Stack icon indicating copy to clipboard operation
Angular-Full-Stack copied to clipboard

Cross-Origin if i want access server on prod system

Open rbrose opened this issue 6 years ago • 0 comments

Hello,

i have this problem that i get Cross-Origin error if Client want call http://localhost:3000/api/login.

i have add a .htaccess with this inside:

######################

Handling Options for the CORS

 RewriteCond %{REQUEST_METHOD} OPTIONS
 RewriteRule ^(.*)$ $1 [L,R=204]

###################

Add custom headers

Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
   # Always set these headers for CORS.
Header always set Access-Control-Max-Age 1728000
Header always set Access-Control-Allow-Origin: "*"
Header always set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header always set Access-Control-Allow-Headers: "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,C$
Header always set Access-Control-Allow-Credentials true

But i not helps. What i can do?

Thank you in advance.

rbrose avatar Oct 17 '18 16:10 rbrose