I have a image I'm trying to load from SVG file. However, my mime.types file on my nginx server has the correct line present:
...
image/svg+xml svg svgz;
...
When I try to download the file, the server is saying it is plain text:
$ wget -O - -S http://172.22.253.119:2998/tw-logo-on-dark-2.svg > /dev/null
--2018-06-26 09:05:06-- http://172.22.253.119:2998/tw-logo-on-dark-2.svg
Connecting to 172.22.253.119:2998... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Server: nginx/1.13.12
Date: Tue, 26 Jun 2018 14:05:06 GMT
Content-Type: text/plain
Content-Length: 26706
Last-Modified: Mon, 25 Jun 2018 16:05:40 GMT
Connection: keep-alive
ETag: "5b3112d4-6852"
Accept-Ranges: bytes
Length: 26706 (26K) [text/plain]
Saving to: ‘STDOUT’
Can anyone tell me what I'm doing wrong?
The solution was to include this in my nginx.conf:
http {
include /etc/nginx/mime.types; # This includes the built in mime types
}
Related
My app has files on firebase storage that i need to serve up to another service. The files are publicly accessible but this service likes to make a HEAD request first which is denied by firebase (error 400).
An this be configured somehow? I believe that Google storage supports this.
eg: file get is ok:
$ curl https://firebasestorage.googleapis.com/v0/b/test-451f9.appspot.com/o/temp%2Fhello.txt?
alt=media -o -
Hello
but the HEAD request:
$ curl --head https://firebasestorage.googleapis.com/v0/b/test-451f9.appspot.com/o/temp%2Fhel
lo.txt?alt=media -o -
HTTP/2 400
x-guploader-uploadid: AEnB2UqWsCbhq_AKpXh29El8_aiJnZqDEUeGsn2i1j0ZPQie0-OB2AQjnKqi_ya50hIw7Yb4WmlKV19ilYQBk9KGdndj4oX9oQ
x-content-type-options: nosniff
content-type: application/json; charset=UTF-8
access-control-expose-headers: Content-Range, X-Firebase-Storage-XSRF
access-control-allow-origin: *
date: Mon, 10 Dec 2018 17:20:52 GMT
expires: Mon, 10 Dec 2018 17:20:52 GMT
cache-control: private, max-age=0
server: UploadServer
alt-svc: quic=":443"; ma=2592000; v="44,43,39,35"
fails.
In particular, I have this response header from an nginx server:
HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 20 Mar 2018 10:28:24 GMT
Content-Type: text/html
Last-Modified: Thu, 28 Jan 2016 10:50:21 GMT
Connection: keep-alive
ETag: W/"56a9f26d-2d97"
Content-Encoding: gzip
Followed by some 3352 Bytes of compressed data. I'm trying to find out how does the client know where the body of this message ends and a new response begins.
It doesn't. The response requires either a Content-Length response header field, or it has to use "Transfer-Encoding: chunked".
For some reason as of yesterday, my cloudfront doesn't work. I am constantly getting 502 errors.
I am using Nginx + Lets Encrypt on Ubuntu 16. Everything used to work just fine and I haven't made any changes to the server.
I spent hours looking for an answer and I am really stuck here as I don't know what's going wrong.
I checked the SSL certificate and it shows as valid with no errors. My SSL ciphers that I use in Nginx are:
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
Doing curl -i https://mycloudfrontdomain.cloudfront.net/wp-includes/js/jquery/jquery.js?ver=1.12.4 produces a valid response in my opinion.
HTTP/1.1 200 OK
Content-Type: application/javascript
Content-Length: 97184
Connection: keep-alive
Server: nginx
Date: Tue, 31 Oct 2017 08:54:04 GMT
Last-Modified: Sun, 04 Sep 2016 21:11:41 GMT
ETag: "xxx-17ba0"
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Access-Control-Allow-Origin: *
Accept-Ranges: bytes
X-Cache: Miss from cloudfront
Via: 1.1 xxx.cloudfront.net (CloudFront)
X-Amz-Cf-Id: xxx-id
The site loads fine with no errors, if I don't use Cloudfront.
ok changing the chiphers to (without the quotes):
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:RSA+3DES:AES128-SHA:!ADH:!AECDH:!MD5;
seems to do the trick. Although I am not quite sure why it used to work fine so far before.
How can I send a POST to ThingSpeak through www.requestmaker.com?
I'm using this:
POST /update HTTP/1.1
Host: api.thingspeak.com
Connection: close
X-THINGSPEAKAPIKEY: XXXXXXXXXXXXXXXX
Content-Type: application/x-www-form-urlencoded\
Content-Length: 24
field1=34&field2=1
But I get this response:
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8
Content-Length: 728
Connection: close
Status: 404 Not Found
X-Request-Id: 36c8113c-3671-4302-85fa-f3ecdba364dc
X-Runtime: 0.019035
X-Powered-By: Phusion Passenger 4.0.57
Date: Mon, 19 Dec 2016 02:36:42 GMT
Server: nginx/1.9.3 + Phusion Passenger 4.0.57
Any solution?
Make sure you have the right API key -- it's common to get zeros and the letter 'O' incorrect. What API end point are you writing to? You can get help on the ThingSpeak forum: http://community.thingspeak.com/forum/
Im trying to serve static .svgz files (compressed SVG) with the below script:
http.ListenAndServe(":9090", http.FileServer(http.Dir("/srv/www/htdocs/")))
im getting the below error:
This page contains the following errors:
error on line 1 at column 1: Encoding error
Below is a rendering of the page up to the first error.
if i try to fetch the same file through apache, the file is displaying properly.
is there a way to fix that?
The Go http.FileServer doesn't automatically add Content-Encoding for sniffed files. If the file is pre-compressed you will need to add the appropriate value.
You can add Content-Encoding: gzip to the headers and, and use http.ServeFile in your handler.
Apache Header (tested in Chrome):
HTTP/1.1 200 OK
Date: Fri, 24 Jun 2016 14:56:03 GMT
Server: Apache
Last-Modified: Fri, 24 Jun 2016 14:43:34 GMT
ETag: "443-5360731fd11b2"
Accept-Ranges: bytes
Content-Length: 1091
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Content-Type: image/svg+xml
Content-Encoding: gzip
Go Header (tested in Chrome):
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 1091
Content-Type: image/svg+xml
Last-Modified: Fri, 24 Jun 2016 14:43:34 GMT
Date: Fri, 24 Jun 2016 14:54:56 GMT
Apache send "Content-Encoding: gzip" in header.
Working code (heavy inspired by https://groups.google.com/forum/#!topic/golang-nuts/Upzqsbu2zbo )
https://play.golang.org/p/eWxqHt9QbM