Skip to content

Failed to load resource: Origin domain.tld is not allowed by Access-Control-Allow-Origin. Status code: 200 #98

Open

Description

@Marcwa19197

Hello, im always getting "Failed to load resource: Origin domain.tld is not allowed by Access-Control-Allow-Origin. Status code: 200" if i press the button and check the Network-Inspector in my Browser.

How can i fix this? Im using the following nginx config as reverse proxy:

# this is required to proxy Grafana Live WebSocket connections.
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

upstream domain.tld {
  server localhost:3000;
}

server {
  listen 80;
  root /usr/share/nginx/html;
  index index.html index.htm;

  location / {
#    proxy_set_header Host $http_host;
#    add_header 'Access-Control-Allow-Origin' '*' always;
#    proxy_pass http://domain.tld;
            add_header  Access-Control-Allow-Origin "*";
            add_header  "Access-Control-Allow-Credentials" "true";
            add_header  "Access-Control-Allow-Methods" "GET, POST, OPTIONS";
            add_header  "Access-Control-Allow-Headers" "Authorization, origin, accept";

            proxy_pass http://localhost:3000;
            proxy_set_header Host $http_host;
            proxy_set_header X-Forwarded-Host $host:$server_port;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  # Proxy Grafana Live WebSocket connections.
  location /api/live/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $http_host;
    proxy_pass http://domain.tld;
  }
}

Activity

  1. Marcwa19197 commented on Mar 18, 2023

    @Marcwa19197
    Author

    no one? :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions