We migrated our LAMP Ubuntu 16.04 (Apache 2.4.7) to a new one with Ubuntu 20.04 (Apache 2.4.41).
Both with a drive mounted on /var/www/intranet/onyar.
With the new one, if I download a file from this mounted drive it's corrupted. With the old one it works. If I download with the old server it's ok. If I access via samba it's ok.
http://newserver/intranet/onyar/test.xls => CORRUPTED
http://oldserver/intranet/onyar/test.xls => OK
\\newserver\root\var\www\intranet\onyar\test.xls => OK
So it seems a problem between Apache and mounted drive? If I try it with a file outside mounted drive (http://newserver/intranet/test.xls) it works OK.
I tested it with txt, office type and PDF files, all corrupted. HTML files works!
I put a simple 'test.txt' file with the string 'hola' inside and I open it with 'http://newserver/intranet/onyar/test.txt' the browser give me this:
Last-Modified: Thu, 12 Nov 2020 09:38:46 GMT
ETag: "4-5b3e5adb1be88"
Accept-Ranges: bytes
Content-Length: 4
Cache-Control: max-age=1209600
Expires: Thu, 26 Nov 2020 09:40:37 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain
holad_ip = dnsResolve(host);
if (isInNet(resolved_ip, "127.0.0.1", "255.255.255.255") || isInNet(resolved_ip, "172.16.0
In fact, if i Ctrl+F5 the string after hola (d_ip = ...) changes sometimes:
Last-Modified: Thu, 12 Nov 2020 09:38:46 GMT
ETag: "4-5b3e5adb1be88"
Accept-Ranges: bytes
Content-Length: 4
Cache-Control: max-age=1209600
Expires: Thu, 26 Nov 2020 09:57:01 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain
holar.</p>
<hr>
<address>Apache/2.4.41 (Ubuntu) Server at 10.80.160.178 Port 80</address>
</body></html>
p>The document h
Last-Modified: Thu, 12 Nov 2020 09:38:46 GMT
ETag: "4-5b3e5adb1be88"
Accept-Ranges: bytes
Content-Length: 4
Cache-Control: max-age=1209600
Expires: Thu, 26 Nov 2020 09:57:01 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain
holaIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document ha
These endings seems to be from other files! Like Apache don't know when is the file ending and puts there some other stuff...
Reference:
fstab: //onyar/dades /var/www/intranet/onyar cifs credentials=/root/.smbcredentials,file_mode=0775,dir_mode=0775,auto 0 0
It seems that I'm affected by this bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900821
For me the solution is putting this in /etc/apache2/apache2.conf:
<Directory "/var/www/intranet/onyar">
EnableMMAP Off
</Directory>
Related
I have configured apache http with some cache settings. However, it does not seem to work properly and the browser seems to keep fetching the file as if it's not cached.
I tried to debug it by fetching the header.
$ curl -skI https://whatever-url-it-is/some-script.js
HTTP/1.1 200 OK
Date: Sun, 15 Sep 2019 05:35:08 GMT
Server: Apache/2.4.39 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
Last-Modified: Sun, 02 Jul 2017 10:52:25 GMT
ETag: "152ba-5535372162c40"
Accept-Ranges: bytes
Content-Length: 86714
Cache-Control: max-age=2592000, public
Expires: Tue, 17 Sep 2019 05:35:08 GMT
Vary: Accept-Encoding,User-Agent
Content-Type: text/javascript
The Cache-Control header seems to be correct. The Expires header looks a little odd but according to this page (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires) the Expire will be ignored given that Cache-Control is there.
What else can I do to debug this issue? Any idea is very well welcome. Thanks
Never mind. I didn't realized that "Disable Cache" was turned on in Chrome. User error :-)
https://api-staging-weld.freetls.fastly.net/scripts/customdomain_weld.19f3e9ec.js
The error I get in Google Search Console is Temporarily unreachable with no further explanation. I think it's something with my http headers but can't figure out which one. Here they are:
accept-ranges: bytes
access-control-allow-origin: *
age: 4905
cache-control: public, max-age=31536000
content-encoding: gzip
content-length: 29990
content-type: application/javascript; charset=UTF-8
date: Fri, 20 Apr 2018 12:46:37 GMT
etag: W/"1a018-162e269bfe0"
last-modified: Fri, 20 Apr 2018 09:36:44 GMT
server: Cowboy
status: 200
vary: Accept-Encoding
via: 1.1 vegur
via: 1.1 varnish
x-cache: HIT
x-cache-hits: 1
x-powered-by: Express
x-served-by: cache-bma7030-BMA
x-timer: S1524228398.925110,VS0,VE6
What's wrong or what am i Missing?
This seems like quite an odd thing to be happening, but I'm getting 404 responses but the pages are still displaying as expected.
I do have a slightly odd setup on this server, as we're running HHVM for PHP pages and using Varnish as we need to direct some of the pages to our old server.
We're running Drupal on this server and it seems to work fine except the 404 response seems to be stopping the login form from working.
I was going to add some images to show what's going on, but unfortunately don't have enough reputation....
here's the what we get from a GET -Sed request
pete#pete-work ~ $ GET -Sed http://beta.newint.org/user
GET http://beta.newint.org/user
404 Not Found
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Date: Wed, 27 May 2015 15:14:23 GMT
Via: 1.1 varnish
Age: 0
Server: Apache
Vary: Accept-Encoding
Content-Language: en
Content-Type: text/html; charset=utf-8
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Client-Date: Wed, 27 May 2015 15:14:23 GMT
Client-Peer: 178.79.141.247:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
ImageToolbar: false
Link: <http://beta.newint.org/user>; rel="canonical",<http://beta.newint.org/user>; rel="shortlink"
Title: User account | Site-Install
X-Generator: Drupal 7 (http://drupal.org)
X-Meta-Charset: utf-8
X-Meta-Generator: Drupal 7 (http://drupal.org)
X-Meta-Viewport: width=device-width, maximum-scale = 1.0
X-Powered-By: HHVM/3.7.0
X-Varnish: 1786764394
And then bypassing varnish and going straight to apache
pete#pete-work ~ $ GET -Sed http://beta.newint.org:8080/user
GET http://beta.newint.org:8080/user
404 Not Found
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Date: Wed, 27 May 2015 15:14:31 GMT
Server: Apache
Vary: Accept-Encoding
Content-Language: en
Content-Type: text/html; charset=utf-8
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Client-Date: Wed, 27 May 2015 15:14:32 GMT
Client-Peer: 178.79.141.247:8080
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
ImageToolbar: false
Link: <http://beta.newint.org:8080/user>; rel="canonical",<http://beta.newint.org:8080/user>; rel="shortlink"
Title: User account | Site-Install
X-Generator: Drupal 7 (http://drupal.org)
X-Meta-Charset: utf-8
X-Meta-Generator: Drupal 7 (http://drupal.org)
X-Meta-Viewport: width=device-width, maximum-scale = 1.0
X-Powered-By: HHVM/3.7.0
Any ideas?
Turns out this was simply due to mod_rewrite not being enabled.
I'm experimenting a very strange issue: using apache-2.2.25 on an Arch Linux server I get a truncated HTTP header in response, but only under windows machines.
I left untouched the httpd.conf file and I have created a file /srv/http/index.html with inside Hello.
With a web browser on a Linux machine I get correctly visualized the hello page, but under Windows I get
.1 200 OK Date: Fri, 15 Nov 2013 08:44:28 GMT Server: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.1e DAV/2 Last-Modified: Fri, 15 Nov 2013 08:15:09 GMT ETag: "27c-a-4eb32cbf8b950" Accept-Ranges: bytes Content-Length: 10 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html; charset=utf-8 Hello
It seems that the http header is truncated for the first characters (HTTP/1).
Have you got any advices?
I have a problem of Content-Type empty for video files and wanted to update those objects with Content-Type: video/** based on extension of the file. But when i am using the put method for same key/bucket with content-type it is being overridden with '0' content-length.
Can I update an existing Amazon S3 object? link says
put will override the file s3 object which doesn't serve my purpose.
Note: I don't want to use Java SDK. I want to use normal the Java httpput due to memory constraints of the mobile.
What you could try is to use the PUT COPY request with the same source and target.
PUT /yourvideo.flv HTTP/1.1
Host: bucket.s3.amazonaws.com
Date: Wed, 28 Oct 2009 22:32:00 GMT
x-amz-copy-source: /bucket/yourvideo.flv
Authorization: AWS AKIAIOSFODNN7EXAMPLE:0RQf4/cRonhpaBX5sCYVf1bNRuU=
Apparently python boto modifies metadata this way
Yes, I can confirm, copy is working:
PUT /test/123.png HTTP/1.1\r\n
Host: yourbucket.s3.amazonaws.com\r\n
Accept-Encoding: identity\r\n
Content-Length: 0\r\n
x-amz-storage-class: STANDARD\r\n
x-amz-copy-source: yourbucket/test/123.png\r\n
Date: Fri, 11 Jan 2013 15:16:48 GMT\r\n
Content-Type: image/gif\r\n # this is the content-type set
Authorization: AWS AKXXXXXDDRXXXXXX63CA:RcktkZ9nPwsXXXXXd+KXXXXXY=\r\n
x-amz-metadata-directive: REPLACE\r\n
\r\n
S3 Reply:
HTTP/1.1 200 OK
x-amz-id-2: Vf1bRJd+e4ru0y73GB0Ra0xYB2vv6GLWYKsHAC4AzE+a8uZB56Xy8+YTDkJ0/wfN
x-amz-request-id: C0E6A2823F3FB3E9
Date: Fri, 11 Jan 2013 15:16:49 GMT
Content-Type: application/xml
Content-Length: 234
Server: AmazonS3
Verification:
HEAD /test/123.png HTTP/1.1\r\n
Host: yourbucket.s3.amazonaws.com\r\n
Accept-Encoding: identity\r\n
Date: Fri, 11 Jan 2013 15:25:23 GMT\r\n
Content-Length: 0\r\n
Authorization: AWS AXXXIXXXXMDDXXXXX7XXXCA :HoZ4Woxxw6SWlxxxx000Rxxm8ODQ=\r\n
\r\n
S3 replies with the correct content-type ( the one I set wrongly to image/gif instead of image/png )
HTTP/1.1 200 OK
x-amz-id-2: 7Ut6sdm6i+1h7Di5UrB4v9Sn3mVCNjyDnkb4rm1jGzN6wBTgDT2/yCSHdrKG12Jd
x-amz-request-id: 38A1F6EC6ECD1D2D
Date: Fri, 11 Jan 2013 15:25:24 GMT
Last-Modified: Fri, 11 Jan 2013 15:25:24 GMT
ETag: "c09fad0faf4e6bb1148670af78b6de41"
Accept-Ranges: bytes
Content-Type: image/gif
Content-Length: 122311
Server: AmazonS3