Error global params
minhvn opened this issue · 11 comments
I still have this error when using the Brave
browser, other browsers are fine.
Access to XMLHttpRequest at 'https://api.tijn.club/admin/get-global-params' from origin 'https://tijn.club' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Seems any request to admin api has this issue.
Triggering invalid memory address in core.
Full trace:
I0505 06:08:01.284066 1 server.go:3139] http: panic serving 172.31.0.3:46838: runtime error: invalid memory address or nil pointer dereference
goroutine 813507 [running]:
net/http.(*conn).serve.func1(0xc17230e1e0)
net/http/server.go:1824 +0x153
panic(0x149c4a0, 0x23f1730)
runtime/panic.go:971 +0x499
zTyrznI2.(*APIServer).ValidateJWT(0xc167c55c00, 0xc046da6680, 0x37, 0x0, 0x0, 0x0, 0x0, 0x0)
pXnKZPRw.go:4 +0x148
zTyrznI2.(*APIServer).CheckAdminPublicKey.func1(0x1c94bd8, 0xc0549ca600, 0xc000161900)
TqQrDV_u.go:1 +0x2fd
net/http.HandlerFunc.ServeHTTP(0xc00d5a9d60, 0x1c94bd8, 0xc0549ca600, 0xc000161900)
net/http/server.go:2069 +0x44
zTyrznI2.FJ3k3YBP.func1(0x1c94bd8, 0xc0549ca600, 0xc000161900)
YEayVYYI.go:1 +0xb0
net/http.HandlerFunc.ServeHTTP(0xc0628f6f60, 0x1c94bd8, 0xc0549ca600, 0xc000161900)
net/http/server.go:2069 +0x44
zTyrznI2.SPR9zx8Y.func1(0x1c94bd8, 0xc0549ca600, 0xc000161900)
g49F3zQZ.go:1 +0x252
net/http.HandlerFunc.ServeHTTP(0xc0628f6f90, 0x1c94bd8, 0xc0549ca600, 0xc000161900)
net/http/server.go:2069 +0x44
github.com/unrolled/secure.(*Secure).Handler.func1(0x1c94bd8, 0xc0549ca600, 0xc000161900)
github.com/unrolled/secure@v1.0.8/secure.go:177 +0xda
net/http.HandlerFunc.ServeHTTP(0xc00bb6dc60, 0x1c94bd8, 0xc0549ca600, 0xc000161900)
net/http/server.go:2069 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc20f3a3e00, 0x1c94bd8, 0xc0549ca600, 0xc000161700)
github.com/gorilla/mux@v1.7.4/mux.go:210 +0xd3
gopkg.in/DataDog/dd-trace-go.v1/contrib/internal/httputil.TraceAndServe(0x1c7c6a0, 0xc20f3a3e00, 0x1c94008, 0xc0549ca600, 0xc000161600, 0x165a6c0, 0xa, 0xc03498e800, 0x1d, 0x0, ...)
gopkg.in/DataDog/dd-trace-go.v1@v1.29.0/contrib/internal/httputil/trace.go:43 +0x577
gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux.(*Router).ServeHTTP(0xc15f067d20, 0x1c94008, 0xc182d5fce0, 0xc000161600)
gopkg.in/DataDog/dd-trace-go.v1@v1.29.0/contrib/gorilla/mux/mux.go:115 +0x231
net/http.serverHandler.ServeHTTP(0xc0000ac1c0, 0x1c94008, 0xc182d5fce0, 0xc000161600)
net/http/server.go:2887 +0xa3
net/http.(*conn).serve(0xc17230e1e0, 0x1c97198, 0xc0549ca4c0)
net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
net/http/server.go:3013 +0x39b
I believe this is fixed. Please reopen if you're still experiencing this issue.
Still error @maebeam
If url is /api/v0 => work
but if have admin /api/v0/admin => have problem
Request URL: https://bitcloutvn.me/api/v0/get-users-stateless
Request Method: POST
Status Code: 200 OK
Request URL: https://bitcloutvn.me/api/v0/admin/node-control
Request Method: POST
Status Code: 502 Bad Gateway
Im run on build backend, and config nginx to proxy_pass
upstream backend {
server 127.0.0.1:17001 weight=1 fail_timeout=600s;
}
server {
server_name bitcloutvn.me;
root /srv/www/bitcloutvn.me/web;
index index.html;
location /api/ {
proxy_pass http://backend;
proxy_read_timeout 300000;
}
location / {
try_files $uri$args $uri$args/ /index.html;
}
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/bitcloutvn.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bitcloutvn.me/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
}
server {
listen 80;
listen [::]:80;
server_name bitcloutvn.me www.bitcloutvn.me;
return 301 https://bitcloutvn.me/$request_uri;
}
ive seen this in Brave browser where others were fine. Are you using brave ?
did you try logout of bitclout and log back in ? this often helps when it happens for me (apart from admin section in brave - that still errors)
ive tried to see if i can spot any errors but https://bitcloutvn.me/ is not loading for me unfortunately.
Try these important steps:
- don't use 127.0.0.1, use localhost instead
- add a trailing slash to root
- pass /api/ to /api/ (note the added trailing slash)
- add www. to the 443 servername too (previously it was only redirecting from port 80)
i left an example below:
server {
server_name bitcloutvn.me www.bitcloutvn.me;
root /srv/www/bitcloutvn.me/web/;
index index.html;
location /api/ {
proxy_pass http://localhost:17001/api/
}
location / {
try_files $uri $uri/ /index.html;
}
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/bitcloutvn.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bitcloutvn.me/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
}
server {
listen 80;
listen [::]:80;
server_name bitcloutvn.me www.bitcloutvn.me;
return 301 https://$host/$request_uri;
}
without www it seems to work already but i cannot test /admin. if you make these changes & restart nginx it may fix your issue.
just one more note... i keep getting this error too. it's usually because backend has had database lockup and needs to be restarted.
@JustifydWarrior Thank sir for your help, but Im still got error :(