HTTP gzip JSON not decoded in Firefox
I am sending a GET request for JSON data to my proxy server via lighttpd:
Firefox -> lighttpd -> proxy server
Lighttpd is configured for gzipped json via the following line in lighttpd.conf:
compress.filetype = ( "application/json", "application/javascript", …)
The proxy server gzips the JSON, adds
Content-Type: application/json
Content-Encoding: "gzip"
to the HTTP response header, and sends the response to lighttpd, which forwards it to the client.
When Firefox receives the response, I get the following error:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
So there is something wrong with the compressed JSON (or its interpretation). I checked that the compressed JSON data has the same hash as if I save the uncompressed JSON to file and gzip it on the command line.
Can anyone offer any insight as to why Firefox won't interpret the compressed JSON?
json apache http compression lighttpd
|
show 1 more comment
I am sending a GET request for JSON data to my proxy server via lighttpd:
Firefox -> lighttpd -> proxy server
Lighttpd is configured for gzipped json via the following line in lighttpd.conf:
compress.filetype = ( "application/json", "application/javascript", …)
The proxy server gzips the JSON, adds
Content-Type: application/json
Content-Encoding: "gzip"
to the HTTP response header, and sends the response to lighttpd, which forwards it to the client.
When Firefox receives the response, I get the following error:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
So there is something wrong with the compressed JSON (or its interpretation). I checked that the compressed JSON data has the same hash as if I save the uncompressed JSON to file and gzip it on the command line.
Can anyone offer any insight as to why Firefox won't interpret the compressed JSON?
json apache http compression lighttpd
Content-Endcoding
- is that just a typo in your question, or copied from your code?
– ADyson
Nov 16 '18 at 10:10
Typo - fixed now.
– user12066
Nov 16 '18 at 10:33
Is the value of the Content-Encoding header field really quoted?
– Julian Reschke
Nov 16 '18 at 11:34
yes it is. I also tried unquoting it and got a Content Encoding Error: The page you are trying to view cannot be shared because it uses an invalid or unsupported form of compression.
– user12066
Nov 16 '18 at 12:15
1
After some thrashing, I discovered that I had my Content-Encoding setting wrong - I had been using deflate instead of gzip for my json compression. So I just changed to Content-Encoding: deflate
– user12066
Nov 28 '18 at 13:37
|
show 1 more comment
I am sending a GET request for JSON data to my proxy server via lighttpd:
Firefox -> lighttpd -> proxy server
Lighttpd is configured for gzipped json via the following line in lighttpd.conf:
compress.filetype = ( "application/json", "application/javascript", …)
The proxy server gzips the JSON, adds
Content-Type: application/json
Content-Encoding: "gzip"
to the HTTP response header, and sends the response to lighttpd, which forwards it to the client.
When Firefox receives the response, I get the following error:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
So there is something wrong with the compressed JSON (or its interpretation). I checked that the compressed JSON data has the same hash as if I save the uncompressed JSON to file and gzip it on the command line.
Can anyone offer any insight as to why Firefox won't interpret the compressed JSON?
json apache http compression lighttpd
I am sending a GET request for JSON data to my proxy server via lighttpd:
Firefox -> lighttpd -> proxy server
Lighttpd is configured for gzipped json via the following line in lighttpd.conf:
compress.filetype = ( "application/json", "application/javascript", …)
The proxy server gzips the JSON, adds
Content-Type: application/json
Content-Encoding: "gzip"
to the HTTP response header, and sends the response to lighttpd, which forwards it to the client.
When Firefox receives the response, I get the following error:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
So there is something wrong with the compressed JSON (or its interpretation). I checked that the compressed JSON data has the same hash as if I save the uncompressed JSON to file and gzip it on the command line.
Can anyone offer any insight as to why Firefox won't interpret the compressed JSON?
json apache http compression lighttpd
json apache http compression lighttpd
edited Nov 16 '18 at 10:33
user12066
asked Nov 16 '18 at 9:45
user12066user12066
121210
121210
Content-Endcoding
- is that just a typo in your question, or copied from your code?
– ADyson
Nov 16 '18 at 10:10
Typo - fixed now.
– user12066
Nov 16 '18 at 10:33
Is the value of the Content-Encoding header field really quoted?
– Julian Reschke
Nov 16 '18 at 11:34
yes it is. I also tried unquoting it and got a Content Encoding Error: The page you are trying to view cannot be shared because it uses an invalid or unsupported form of compression.
– user12066
Nov 16 '18 at 12:15
1
After some thrashing, I discovered that I had my Content-Encoding setting wrong - I had been using deflate instead of gzip for my json compression. So I just changed to Content-Encoding: deflate
– user12066
Nov 28 '18 at 13:37
|
show 1 more comment
Content-Endcoding
- is that just a typo in your question, or copied from your code?
– ADyson
Nov 16 '18 at 10:10
Typo - fixed now.
– user12066
Nov 16 '18 at 10:33
Is the value of the Content-Encoding header field really quoted?
– Julian Reschke
Nov 16 '18 at 11:34
yes it is. I also tried unquoting it and got a Content Encoding Error: The page you are trying to view cannot be shared because it uses an invalid or unsupported form of compression.
– user12066
Nov 16 '18 at 12:15
1
After some thrashing, I discovered that I had my Content-Encoding setting wrong - I had been using deflate instead of gzip for my json compression. So I just changed to Content-Encoding: deflate
– user12066
Nov 28 '18 at 13:37
Content-Endcoding
- is that just a typo in your question, or copied from your code?– ADyson
Nov 16 '18 at 10:10
Content-Endcoding
- is that just a typo in your question, or copied from your code?– ADyson
Nov 16 '18 at 10:10
Typo - fixed now.
– user12066
Nov 16 '18 at 10:33
Typo - fixed now.
– user12066
Nov 16 '18 at 10:33
Is the value of the Content-Encoding header field really quoted?
– Julian Reschke
Nov 16 '18 at 11:34
Is the value of the Content-Encoding header field really quoted?
– Julian Reschke
Nov 16 '18 at 11:34
yes it is. I also tried unquoting it and got a Content Encoding Error: The page you are trying to view cannot be shared because it uses an invalid or unsupported form of compression.
– user12066
Nov 16 '18 at 12:15
yes it is. I also tried unquoting it and got a Content Encoding Error: The page you are trying to view cannot be shared because it uses an invalid or unsupported form of compression.
– user12066
Nov 16 '18 at 12:15
1
1
After some thrashing, I discovered that I had my Content-Encoding setting wrong - I had been using deflate instead of gzip for my json compression. So I just changed to Content-Encoding: deflate
– user12066
Nov 28 '18 at 13:37
After some thrashing, I discovered that I had my Content-Encoding setting wrong - I had been using deflate instead of gzip for my json compression. So I just changed to Content-Encoding: deflate
– user12066
Nov 28 '18 at 13:37
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53335183%2fhttp-gzip-json-not-decoded-in-firefox%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53335183%2fhttp-gzip-json-not-decoded-in-firefox%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Content-Endcoding
- is that just a typo in your question, or copied from your code?– ADyson
Nov 16 '18 at 10:10
Typo - fixed now.
– user12066
Nov 16 '18 at 10:33
Is the value of the Content-Encoding header field really quoted?
– Julian Reschke
Nov 16 '18 at 11:34
yes it is. I also tried unquoting it and got a Content Encoding Error: The page you are trying to view cannot be shared because it uses an invalid or unsupported form of compression.
– user12066
Nov 16 '18 at 12:15
1
After some thrashing, I discovered that I had my Content-Encoding setting wrong - I had been using deflate instead of gzip for my json compression. So I just changed to Content-Encoding: deflate
– user12066
Nov 28 '18 at 13:37