Mangled HTTP output for static files on mountpoint
chrisvrose opened this issue · 3 comments
On a k3s cluster where the mountpoint is a SMB mountpoint
All my static file requests have mangled responses (The autogenerated indices work good)
Here is the output of trying to fetch /
( Works OK )
curl --http0.9 -iv --raw http://localhost:8080/ --output -
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.84.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 11 Jul 2022 13:37:43 GMT
Date: Mon, 11 Jul 2022 13:37:43 GMT
< Server: Apache/2.4.54 (Unix)
Server: Apache/2.4.54 (Unix)
< Content-Length: 291
Content-Length: 291
< Content-Type: text/html;charset=ISO-8859-1
Content-Type: text/html;charset=ISO-8859-1
<
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /</title>
</head>
<body>
<h1>Index of /</h1>
<ul><li><a href="Formats/"> Formats/</a></li>
<li><a href="README.md"> README.md</a></li>
<li><a href="le_books/"> le_books/</a></li>
</ul>
</body></html>
* Connection #0 to host localhost left intact
Here is the output of trying to fetch /README.md
( Not working )
curl -iv --raw http://localhost:8080/README.md
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /README.md HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.84.0
> Accept: */*
>
* Received HTTP/0.9 when not allowed
* Closing connection 0
curl: (1) Received HTTP/0.9 when not allowed
Adding the --http0.9 flag reveals the rest of the malformed body.
curl --http0.9 -iv --raw http://localhost:8080/README.md --output -
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /README.md HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.84.0
> Accept: */*
>
2:56:26 GMT
ETag: "29-5e387146f7c14"
Accept-Ranges: bytes
Content-Length: 41
# Start of my readme
This is a README.md
DHnQQFid4��,A�u��6�
* Closing connection 0
��
Expected
Expected result from curl (Seen with nginx
image):
curl -iv --raw http://localhost:8080/README.md --output -
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /README.md HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.84.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: nginx/1.23.0
Server: nginx/1.23.0
< Date: Mon, 11 Jul 2022 13:10:53 GMT
Date: Mon, 11 Jul 2022 13:10:53 GMT
< Content-Type: application/octet-stream
Content-Type: application/octet-stream
< Content-Length: 41
Content-Length: 41
< Last-Modified: Mon, 11 Jul 2022 12:56:26 GMT
Last-Modified: Mon, 11 Jul 2022 12:56:26 GMT
< Connection: keep-alive
Connection: keep-alive
< ETag: "62cc1dfa-29"
ETag: "62cc1dfa-29"
< Accept-Ranges: bytes
Accept-Ranges: bytes
<
# Start of my readme
This is a README.md
* Connection #0 to host localhost left intact
The container logs suggest no abnornmal behaviour
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.42.0.23. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.42.0.23. Set the 'ServerName' directive globally to suppress this message
[Mon Jul 11 18:48:13.571711 2022] [mpm_event:notice] [pid 1:tid 281465104137856] AH00489: Apache/2.4.54 (Unix) configured -- resuming normal operations
[Mon Jul 11 18:48:13.571891 2022] [core:notice] [pid 1:tid 281465104137856] AH00094: Command line: 'httpd -D FOREGROUND'
127.0.0.1 - - [11/Jul/2022:18:48:45 +0530] "GET /README.md HTTP/1.1" 200 41
10.42.0.8 - - [11/Jul/2022:18:50:42 +0530] "GET / HTTP/1.1" 200 291
Versions tried with:
2.4.48
2.4.54 (latest)
Steps to reproduce:
Seemed like it's missing locales for the language/encoding of the readme.md. It's a file you're providing so I can't reproduce the issue as-is
But providing one with different languages does display correctly so not sure what's causing the issue on your end. My guess is something with the Samba folder
k3s
$ curl -sfL https://get.k3s.io | sh -s - --docker
[INFO] Finding release for channel stable
[INFO] Using v1.23.8+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.23.8+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.23.8+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Skipping /usr/local/bin/ctr symlink to k3s, command exists in PATH at /usr/bin/ctr
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
$ sudo chmod 777 /etc/rancher/k3s/k3s.yaml
$ cat httpd.yaml
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- image: httpd:2.4
name: httpd
volumeMounts:
- mountPath: /usr/local/apache2/htdocs/
name: test
volumes:
- name: test
hostPath:
path: /tmp/test
$ kubectl apply -f httpd.yaml
pod/test created
$ kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
test 1/1 Running 0 21s 10.42.0.9 demo <none> <none>
$ curl --http0.9 -iv --raw http://10.42.0.9/README.md --output -
* Expire in 0 ms for 6 (transfer 0x557f8f1b20f0)
* Trying 10.42.0.9...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x557f8f1b20f0)
* Connected to 10.42.0.9 (10.42.0.9) port 80 (#0)
> GET /README.md HTTP/1.1
> Host: 10.42.0.9
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 11 Jul 2022 16:47:18 GMT
Date: Mon, 11 Jul 2022 16:47:18 GMT
< Server: Apache/2.4.54 (Unix)
Server: Apache/2.4.54 (Unix)
< Last-Modified: Mon, 11 Jul 2022 16:43:53 GMT
Last-Modified: Mon, 11 Jul 2022 16:43:53 GMT
< ETag: "a3a-5e38a41dfb472"
ETag: "a3a-5e38a41dfb472"
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Content-Length: 2618
Content-Length: 2618
<
Afrikaans: Hello Wêreld!
Albanian: Përshendetje Botë!
Amharic: ሰላም ልዑል!
Arabic: مرحبا بالعالم!
Armenian: Բարեւ աշխարհ!
Basque: Kaixo Mundua!
Belarussian: Прывітанне Сусвет!
Bengali: ওহে বিশ্ব!
Bulgarian: Здравей свят!
Catalan: Hola món!
Chichewa: Moni Dziko Lapansi!
Chinese: 你好世界!
Croatian: Pozdrav svijete!
Czech: Ahoj světe!
Danish: Hej Verden!
Dutch: Hallo Wereld!
English: Hello World!
Estonian: Tere maailm!
Finnish: Hei maailma!
French: Bonjour monde!
Frisian: Hallo wrâld!
Georgian: გამარჯობა მსოფლიო!
German: Hallo Welt!
Greek: Γειά σου Κόσμε!
Hausa: Sannu Duniya!
Hebrew: שלום עולם!
Hindi: नमस्ते दुनिया!
Hungarian: Helló Világ!
Icelandic: Halló heimur!
Igbo: Ndewo Ụwa!
Indonesian: Halo Dunia!
Italian: Ciao mondo!
Japanese: こんにちは世界!
Kazakh: Сәлем Әлем!
Khmer: សួស្តីពិភពលោក!
Kyrgyz: Салам дүйнө!
Lao: ສະບາຍດີຊາວໂລກ!
Latvian: Sveika pasaule!
Lithuanian: Labas pasauli!
Luxemburgish: Moien Welt!
Macedonian: Здраво свету!
Malay: Hai dunia!
Malayalam: ഹലോ വേൾഡ്!
Mongolian: Сайн уу дэлхий!
Myanmar: မင်္ဂလာပါကမ္ဘာလောက!
Nepali: नमस्कार संसार!
Norwegian: Hei Verden!
Pashto: سلام نړی!
Persian: سلام دنیا!
Polish: Witaj świecie!
Portuguese: Olá Mundo!
Punjabi: ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ!
Romanian: Salut Lume!
Russian: Привет мир!
Scots Gaelic: Hàlo a Shaoghail!
Serbian: Здраво Свете!
Sesotho: Lefatše Lumela!
Sinhala: හෙලෝ වර්ල්ඩ්!
Slovenian: Pozdravljen svet!
Spanish: ¡Hola Mundo! // Leading '¡' optional
Sundanese: Halo Dunya!
Swahili: Salamu Dunia!
Swedish: Hej världen!
Tajik: Салом Ҷаҳон!
Thai: สวัสดีชาวโลก!
Turkish: Selam Dünya!
Ukrainian: Привіт Світ!
Uzbek: Salom Dunyo!
Vietnamese: Chào thế giới!
Welsh: Helo Byd!
Xhosa: Molo Lizwe!
Yiddish: העלא וועלט!
Yoruba: Mo ki O Ile Aiye!
Zulu: Sawubona Mhlaba!
* Connection #0 to host 10.42.0.9 left intact
docker
$ docker run -d --name my-apache-app -p 8080:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4
45ef5c91551ca0d13a11570534a682a9699e47b3d1019a2c9cf2a1cc38da5249
$ ls
README.md
$ curl --http0.9 -iv --raw http://localhost:8080/README.md --output -
* Expire in 0 ms for 6 (transfer 0x56517c80f0f0)
* Expire in 1 ms for 1 (transfer 0x56517c80f0f0)
* Expire in 0 ms for 1 (transfer 0x56517c80f0f0)
* Expire in 1 ms for 1 (transfer 0x56517c80f0f0)
* Expire in 0 ms for 1 (transfer 0x56517c80f0f0)
* Expire in 0 ms for 1 (transfer 0x56517c80f0f0)
* Expire in 0 ms for 1 (transfer 0x56517c80f0f0)
* Trying ::1...
* TCP_NODELAY set
* Expire in 150000 ms for 3 (transfer 0x56517c80f0f0)
* Expire in 200 ms for 4 (transfer 0x56517c80f0f0)
* Connected to localhost (::1) port 8080 (#0)
> GET /README.md HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 11 Jul 2022 16:31:44 GMT
Date: Mon, 11 Jul 2022 16:31:44 GMT
< Server: Apache/2.4.54 (Unix)
Server: Apache/2.4.54 (Unix)
< Last-Modified: Mon, 11 Jul 2022 16:30:34 GMT
Last-Modified: Mon, 11 Jul 2022 16:30:34 GMT
< ETag: "a3a-5e38a1240788e"
ETag: "a3a-5e38a1240788e"
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Content-Length: 2618
Content-Length: 2618
<
Afrikaans: Hello Wêreld!
Albanian: Përshendetje Botë!
Amharic: ሰላም ልዑል!
Arabic: مرحبا بالعالم!
Armenian: Բարեւ աշխարհ!
Basque: Kaixo Mundua!
Belarussian: Прывітанне Сусвет!
Bengali: ওহে বিশ্ব!
Bulgarian: Здравей свят!
Catalan: Hola món!
Chichewa: Moni Dziko Lapansi!
Chinese: 你好世界!
Croatian: Pozdrav svijete!
Czech: Ahoj světe!
Danish: Hej Verden!
Dutch: Hallo Wereld!
English: Hello World!
Estonian: Tere maailm!
Finnish: Hei maailma!
French: Bonjour monde!
Frisian: Hallo wrâld!
Georgian: გამარჯობა მსოფლიო!
German: Hallo Welt!
Greek: Γειά σου Κόσμε!
Hausa: Sannu Duniya!
Hebrew: שלום עולם!
Hindi: नमस्ते दुनिया!
Hungarian: Helló Világ!
Icelandic: Halló heimur!
Igbo: Ndewo Ụwa!
Indonesian: Halo Dunia!
Italian: Ciao mondo!
Japanese: こんにちは世界!
Kazakh: Сәлем Әлем!
Khmer: សួស្តីពិភពលោក!
Kyrgyz: Салам дүйнө!
Lao: ສະບາຍດີຊາວໂລກ!
Latvian: Sveika pasaule!
Lithuanian: Labas pasauli!
Luxemburgish: Moien Welt!
Macedonian: Здраво свету!
Malay: Hai dunia!
Malayalam: ഹലോ വേൾഡ്!
Mongolian: Сайн уу дэлхий!
Myanmar: မင်္ဂလာပါကမ္ဘာလောက!
Nepali: नमस्कार संसार!
Norwegian: Hei Verden!
Pashto: سلام نړی!
Persian: سلام دنیا!
Polish: Witaj świecie!
Portuguese: Olá Mundo!
Punjabi: ਸਤਿ ਸ੍ਰੀ ਅਕਾਲ ਦੁਨਿਆ!
Romanian: Salut Lume!
Russian: Привет мир!
Scots Gaelic: Hàlo a Shaoghail!
Serbian: Здраво Свете!
Sesotho: Lefatše Lumela!
Sinhala: හෙලෝ වර්ල්ඩ්!
Slovenian: Pozdravljen svet!
Spanish: ¡Hola Mundo! // Leading '¡' optional
Sundanese: Halo Dunya!
Swahili: Salamu Dunia!
Swedish: Hej världen!
Tajik: Салом Ҷаҳон!
Thai: สวัสดีชาวโลก!
Turkish: Selam Dünya!
Ukrainian: Привіт Світ!
Uzbek: Salom Dunyo!
Vietnamese: Chào thế giới!
Welsh: Helo Byd!
Xhosa: Molo Lizwe!
Yiddish: העלא וועלט!
Yoruba: Mo ki O Ile Aiye!
Zulu: Sawubona Mhlaba!
* Connection #0 to host localhost left intact
You could also try asking over at the Docker Community Forums, Docker Community Slack, or Stack Overflow. Since these repos aren't really a user-help forum
I have attached the README.md in question.
Thank you for looking into it, I will ask in these communities.
Edit: It is a simple UTF-8 encoding English textfile
It seems to be an issue with mmap
ing.
A workaround is by adding the config to /etc/apache2/apache2.conf
EnableMMAP off
Source: https://stackoverflow.com/questions/65092742/how-do-i-debug-broken-response-headers-in-apache
It is not an issue particularly with the image, since docker works as well, so I will close it. Apologies for any inconvenience.