Unexpected non-JSON response

While trying to push templates coder-cli errors, reading a previous thread i checked the server and client version and they are the exact same commit
No description
35 Replies
Phorcys
Phorcys2y ago
@MRtecno98 any reverse proxy?
MRtecno98
MRtecno98OP2y ago
Yep, nginx with ssl and a cloudflare certificate
Phorcys
Phorcys2y ago
can you show me your nginx config?
MRtecno98
MRtecno98OP2y ago
No description
MRtecno98
MRtecno98OP2y ago
the comments are from the default installation
MRtecno98
MRtecno98OP2y ago
ah thank you I'm getting the same error
Phorcys
Phorcys2y ago
oh yeah i looked a bit too fast you'd need it anyways but that's not it can you show me your config again? also, does the homepage even load properly?
MRtecno98
MRtecno98OP2y ago
The rest is the same, i just added what you told me
No description
MRtecno98
MRtecno98OP2y ago
the webui works prefectly, i could also login using the cli it crashes only when uploading templates
Phorcys
Phorcys2y ago
@kyle can you take a look? for some reason the server's not responding with JSON, at first I would've said it's a reverse-proxy issue but the config looks good, so it could be a bug of some sort?
kyle
kyle2y ago
When uploading templates certainly means this is a WebSocket related issue.
MRtecno98
MRtecno98OP2y ago
I also tried disabling cloudflare proxying but it gives the same error
Phorcys
Phorcys2y ago
did you add the map statement too?
MRtecno98
MRtecno98OP2y ago
oh my god i'm an idiot sorry totally didn't see that
MRtecno98
MRtecno98OP2y ago
now it runs for a little while but then fails with another error
No description
Phorcys
Phorcys2y ago
looks like the same error to me hold on can you send me your full config as text just to check
MRtecno98
MRtecno98OP2y ago
i don't think it said text/plain last time oh yeah it did sorry lol, i'll send the config in a minute
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;

ssl_certificate /etc/nginx/ssl/mrtecno.tk/cert.pem;
ssl_certificate_key /etc/nginx/ssl/mrtecno.tk/key.pem;

server_name dev.mrtecno.tk;

location / {
proxy_pass http://127.0.0.1:3000;

proxy_pass_request_headers on;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Accept-Encoding gzip;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;

ssl_certificate /etc/nginx/ssl/mrtecno.tk/cert.pem;
ssl_certificate_key /etc/nginx/ssl/mrtecno.tk/key.pem;

server_name dev.mrtecno.tk;

location / {
proxy_pass http://127.0.0.1:3000;

proxy_pass_request_headers on;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Accept-Encoding gzip;
}
}
I added the map statement and also removed all the comments
Phorcys
Phorcys2y ago
and that doesn't work? dumb question -- did you restart nginx?
MRtecno98
MRtecno98OP2y ago
nope yes lol i also tried restarting coder
Phorcys
Phorcys2y ago
can you try adding proxy_http_version 1.1; ?
MRtecno98
MRtecno98OP2y ago
it works lol thank you
Phorcys
Phorcys2y ago
did that fix it ?
MRtecno98
MRtecno98OP2y ago
yep
Phorcys
Phorcys2y ago
i think that happened some other time too and i remembered now
MRtecno98
MRtecno98OP2y ago
i have absolutely 0 idea why possibly websockets not liking some http versions?
Phorcys
Phorcys2y ago
I think your global nginx settings default to 1.0
MRtecno98
MRtecno98OP2y ago
probably, it's from the debian repos
Phorcys
Phorcys2y ago
well websockets are only in the 1.1+ HTTP specs so 1.0 will think it's text
MRtecno98
MRtecno98OP2y ago
ah yeah then that's why
Phorcys
Phorcys2y ago
you can close this thread by using /resolve
MRtecno98
MRtecno98OP2y ago
k
Codercord
Codercord2y ago
Marked the thread as resolved.
MRtecno98
MRtecno98OP2y ago
thank you again :)
Phorcys
Phorcys2y ago
happy to help
Want results from more Discord servers?
Add your server