TheRemote / MinecraftBedrockServer

Sets up a Minecraft Bedrock dedicated server on Ubuntu with options for automatic updates and running at startup
https://jamesachambers.com/minecraft-bedrock-edition-ubuntu-dedicated-server-guide/
MIT License
811 stars 173 forks source link

Update start.sh #95

Closed titiscan closed 3 years ago

titiscan commented 3 years ago

Access Denied while downloading update

TheRemote commented 3 years ago

This is really interesting. It seems like maybe the downloads folder had the wrong permissions, or maybe just the version.html file itself.

I haven't got this behavior but it looks really interesting what you're doing. You seem to be downloading a gzipped version of the page. Can you explain a little bit more?

titiscan commented 3 years ago

Hi, when I tried to download the index.html from Minecraft server with curl (even in root), I got the file but it does not contain any information about server's version.

<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;www&#46;minecraft&#46;net&#47;en&#45;us&#47;download&#47;server&#47;bedrock" on this server.<P>
Reference&#32;&#35;18&#46;5ed7b5c&#46;1625267927&#46;2390560

Adding headers is the way I've found to get the correct file

Regards

Ps: on Ubuntu 20.04

TheRemote commented 3 years ago

Curious, can you make sure you have the latest version? The latest one should be using the -L flag which should take care of the location headers but maybe there's something else going on here! Can you verify your start.sh (and SetupMinecraft.sh) is up to date here? I'd like to continue to investigate this just to understand why it's happening (and not to everyone)!

I've done like 20 upgrades today as well so I want to make sure we're on the same page here before we dive in deeper!

titiscan commented 3 years ago

Thanks for your time, I just try in console (bash) from user and root the curl command :

curl -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.1234.212 Safari/537.36" -o test.html https://www.minecraft.net/en-us/download/server/bedrock

And the result (cat test.html)

<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>

You don't have permission to access "http&#58;&#47;&#47;www&#46;minecraft&#46;net&#47;en&#45;us&#47;download&#47;server&#47;bedrock" on this server.<P>
Reference&#32;&#35;18&#46;4ed7b5c&#46;1625311242&#46;c2027da
</BODY>
</HTML>
TheRemote commented 3 years ago

Thanks for that, I am wondering if it's the:

-H "Accept-Language: en"

Is your computer's default language not English by chance? You're still the only one that has reported this and I'm trying to figure out what's "special" about yours! It doesn't make a lot of sense that it would serve you the gzipped version of the exact same content, but you're clearly getting access denied without these headers which is why I was wondering if maybe that's what is different from most people's setups!

I just uploaded a version that adds the language headers as a test if you'd like to try it as well!

titiscan commented 3 years ago

Sorry I don't know what is special about my configuration. My locale is set to "en_US.UTF-8".

Adding only the Accept-Language doesn't change the result but you made me think of something.

When I tried to make it work I just copied all headers from my regular browser and searched which was necessary. So I tried to change the "Accept-Encoding" header to "identity" and it works without compression

-H "Accept-Encoding: identity"

Regards

TheRemote commented 3 years ago

Fantastic find, wow! I honestly have not encountered this issue before but I was able to find this:

(https://github.com/whatwg/fetch/issues/747)

Although this specific bug is not specific to what we're talking about here they did discuss that some servers seem to be configured to expect this header. The only part I don't understand is why don't I have to have it (or almost everyone else).

May I ask which distro and version this is? That may help shed some light on this. I'll for sure upload this change!

titiscan commented 3 years ago

I'm on Ubuntu 20.04 (vps from a French provider)

And curl version is

# curl -V
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets