aws-samples / dcv-web-portal

Other
18 stars 8 forks source link

Sessions loading error #11

Open ginodecock opened 12 months ago

ginodecock commented 12 months ago

Hi,

I have the solution fully deployed and the portal is up adn running. I am able to start a linux and windows host. However the started instances are not listed and the interface has always a popup saying

sdfsdfjkds.cloudfront.net says Sessions loading error

Any idea what is the cause?

ginodecock commented 12 months ago

It seems to be a CORS issue. To solve this, is there an extra configuration required? cors error

jeromevdl commented 12 months ago

Make sure the API Gateway is properly configured: The resource policy must contain the CIDR containing your IP. This is what you configured in the variables.tf file, but if your ip local ip changes, you need to update this. It works well for companies with a fixed CIDR but less for personal network where the IP can change.

{
  "Version": "2012-10-17",
  "Statement": [{
      "Effect": "Allow",
      "Principal": "*",
      "Action": "execute-api:Invoke",
      "Resource": "execute-api:/*/*/*"
    },
    {
      "Effect": "Deny",
      "Principal": "*",
      "Action": "execute-api:Invoke",
      "Resource": "execute-api:/*/*/*",
      "Condition": {
        "NotIpAddress": {
          "aws:SourceIp": [....] <= HERE
        }
      }
    }
  ]
}
signalconductor commented 11 months ago

I am having the same issue, even with the proper CIDR entered in the variables.tf file. I had the deployment working once with this, but all subsequent deployments have resulted in the same error.

In my WAF, I see blocked requests from IPs other than my own at the same time as seeing approved requests from my correct IP. One of them appeared to be a Google cache IP.

jeromevdl commented 11 months ago

When I had CORS errors during development, it was only because of the API Gateway resource policy not updated with my IP, which is different from the WAF (even if they use both the same CIDR configured in the variables.tf). If you update the API Gateway resource policy, make sure to redeploy the API.