Question

Don't work CORS in server with Directus

Posted November 9, 2021 67 views
Angular

Hi, I’m using digitalocean for deploy but when I want to connect I see this error: “Referrer Policy: strict-origin-when-cross-origin”
The question is How fixed this error?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @juanitourquiza,

What is your proxy configuration? Most times it’s related to how the proxy.conf.json or whatever you are using file is created.

If you don’t have one, try with the following:

Open a new command-line interface and navigate to the root folder of your project.

Next, create src/proxy.conf.json file and add the following content:

{
    "/api/*": {
        "target": "http://localhost:3000",
        "secure": false,
        "logLevel": "debug"
    }
}

Next, open the angular.json file and add a proxyConfig key under the serve->options that points to the src/proxy.conf.json file as follows:

"architect": {
  "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
      "browserTarget": "your-application-name:build",
      "proxyConfig": "src/proxy.conf.json"
    },

Of course, there are variables that you’ll need to change from the above examples like the port( in case you are using another port ofcourse).