Question

Don't work CORS in server with Directus

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

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).