#Get the disk usage by the API (access-control-allow-origin problem)

1 messages · Page 1 of 1 (latest)

jovial marten
#

Any idea?

long pike
#

Client > Server > Resource Usage

eager rivetBOT
#

The server resource usage is retrieved from Docker stats. Type docker stats and make sure that statistics are displayed correctly for all containers.

Broken docker stats can be caused by your Linux Kernel cgroups controllers not functioning or the wrong Docker version installed by using a package manager or performing a system package upgrade.

Type .cgroup in this chat for me to provide more information about cgroup and containerd issues that a lot of Ubuntu users are experiencing after updating their system.

The correct Docker version (docker-ce) is installed at https://pterodactyl.io/wings/1.0/installing.html#installing-docker

Restart the servers to rebuild containers once you have fixed your docker stats.

long pike
#

thats wrong one xD

jovial marten
jovial marten
#

I still have a small/big problem.
When I want to make an API query comes back (picture 1):

t :63342' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-AIIow-Origin'
header contains multiple values
• but only one is allowed. Have the server send the header With a valid value, or, if an opaque response serves your needs,
set the request's mode to 'no-cors• to fetch the resource With CORS disabled.```
I looked at the headers that come with it and yes there are 2 pieces (picture 2). 
Now I have tried to disable the one that probably does not come from my reverse proxy but from Ptero directly?
```nginx
proxy_hide_header Access-Control-Allow-Origin;

And the correct one looks like this:

  add_header 'Access-Control-Allow-Origin' *;

Now I have looked at the headers again and there is the correct entry now inside (picture 3).
However, I now get the error that the entry is completely missing, although it is there...
Cross-source (cross-origin) request blocked: The same-source rule prohibits reading the external resource at URL. (Reason: CORS header 'Access-Control-Allow-Origin' is missing). Status code: 401.
Am now for 3-4h trying but it does not want to work. Does anyone here maybe a solution?

eager rivetBOT
#

@jovial marten Your Panel remote URL in the Wings config.yml does not match with the URL from which you're making the request. Make sure that they match for the connection to work.

If you know what you are doing and are intentionally trying to use a different origin, make sure to add it to your Wings config.yml allowed origins as shown in the example below. Use correct HTTP or HTTPS scheme. Wildcard '*' can be used to allow all origins.

allowed_origins:
- https://test.source.com
- http://another.panel.com

Restart Wings systemctl restart wings to apply the change.

jovial marten
#

So now got:

remote_query:
  timeout: 30
  boot_servers_per_page: 50
allowed_mounts: []
allowed_origins:
- '*'
allow_cors_private_network: false```
But get the error:
```js
Access to fetch at 'URL' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
eager rivetBOT
#

@jovial marten Your Panel remote URL in the Wings config.yml does not match with the URL from which you're making the request. Make sure that they match for the connection to work.

If you know what you are doing and are intentionally trying to use a different origin, make sure to add it to your Wings config.yml allowed origins as shown in the example below. Use correct HTTP or HTTPS scheme. Wildcard '*' can be used to allow all origins.

allowed_origins:
- https://test.source.com
- http://another.panel.com

Restart Wings systemctl restart wings to apply the change.

jovial marten
#

It won't work...

eager rivetBOT
#

Please explain the issue you're experiencing in as much detail as possible. Preferably with error messages in a text format or paste link to logs. Nobody can assist you without information that helps to understand the issue. Help us help you. Messages such as "doesn't work" or "i need help" will most likely be ignored.

jovial marten
#

Get the disk usage by the API (access-control-allow-origin problem)

soft garnet
#

Access to fetch at 'https://linuxgames.phenixmg.fr/api/client' from origin 'https://gmodsupervisor.kashir.fr' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

eager rivetBOT
#

@soft garnet Your Panel remote URL in the Wings config.yml does not match with the URL from which you're making the request. Make sure that they match for the connection to work.

If you know what you are doing and are intentionally trying to use a different origin, make sure to add it to your Wings config.yml allowed origins as shown in the example below. Use correct HTTP or HTTPS scheme. Wildcard '*' can be used to allow all origins.

allowed_origins:
- https://test.source.com
- http://another.panel.com

Restart Wings systemctl restart wings to apply the change.

soft garnet
#

Still didn't work

#

Access to fetch at 'https://linuxgames.phenixmg.fr/api/client' from origin 'https://gmodsupervisor.kashir.fr' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

eager rivetBOT
#

@soft garnet Your Panel remote URL in the Wings config.yml does not match with the URL from which you're making the request. Make sure that they match for the connection to work.

If you know what you are doing and are intentionally trying to use a different origin, make sure to add it to your Wings config.yml allowed origins as shown in the example below. Use correct HTTP or HTTPS scheme. Wildcard '*' can be used to allow all origins.

allowed_origins:
- https://test.source.com
- http://another.panel.com

Restart Wings systemctl restart wings to apply the change.

soft garnet
soft garnet
hollow shard
#

I think that the allowed_origins setting doesn't work as expected

eager rivetBOT
#

Please explain the issue you're experiencing in as much detail as possible. Preferably with error messages in a text format or paste link to logs. Nobody can assist you without information that helps to understand the issue. Help us help you. Messages such as "doesn't work" or "i need help" will most likely be ignored.