Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,25 @@ configs:

client_max_body_size ${MAX_CONTENT_LENGTH:-2097152};

gzip on;
gzip_proxied any;
gzip_types
application/json
application/ld+json
application/rdf+xml
application/sparql-results+json
application/sparql-results+xml
application/trig
application/n-quads
application/n-triples
application/xml
text/turtle
text/css
text/javascript
application/javascript
image/svg+xml;
gzip_min_length 1024;

# server with optional client cert authentication
server {
listen 8443 ssl;
Expand Down
52 changes: 52 additions & 0 deletions http-tests/misc/gzip-rdfxml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail

initialize_dataset "$END_USER_BASE_URL" "$TMP_END_USER_DATASET" "$END_USER_ENDPOINT_URL"
initialize_dataset "$ADMIN_BASE_URL" "$TMP_ADMIN_DATASET" "$ADMIN_ENDPOINT_URL"
purge_cache "$END_USER_VARNISH_SERVICE"
purge_cache "$ADMIN_VARNISH_SERVICE"
purge_cache "$FRONTEND_VARNISH_SERVICE"

# Test that nginx gzip compression is active for RDF/XML dynamic content.
# Create an item, append enough data to exceed gzip_min_length, then retrieve it as RDF/XML.

add-agent-to-group.sh \
-f "$OWNER_CERT_FILE" \
-p "$OWNER_CERT_PWD" \
--agent "$AGENT_URI" \
"${ADMIN_BASE_URL}acl/groups/writers/"

item=$(create-item.sh \
-f "$AGENT_CERT_FILE" \
-p "$AGENT_CERT_PWD" \
-b "$END_USER_BASE_URL" \
--title "Gzip test item" \
--slug "gzip-test" \
--container "$END_USER_BASE_URL")

printf '@prefix ex: <http://example.org/> .\n
<> ex:prop1 "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore." ;\n
ex:prop2 "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo." ;\n
ex:prop3 "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." ;\n
ex:prop4 "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est." .\n' \
| post.sh \
-f "$AGENT_CERT_FILE" \
-p "$AGENT_CERT_PWD" \
-t "text/turtle" \
"$item"

response=$(curl -k -s -D - -o /dev/null \
-H "Accept-Encoding: gzip" \
-H "Accept: application/rdf+xml" \
-E "$AGENT_CERT_FILE":"$AGENT_CERT_PWD" \
"$item")

if ! echo "$response" | grep -qi "Content-Encoding: gzip"; then
echo "Content-Encoding: gzip not found on RDF/XML response"
exit 1
fi

if ! echo "$response" | grep -q "HTTP/.* 200"; then
echo "RDF/XML request did not return 200 OK"
exit 1
fi
18 changes: 18 additions & 0 deletions http-tests/misc/gzip-sefjson.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

# Test that nginx gzip compression is active for static JSON (SEF file)

response=$(curl -k -s -D - -o /dev/null \
-H "Accept-Encoding: gzip" \
"${END_USER_BASE_URL}static/com/atomgraph/linkeddatahub/xsl/client.xsl.sef.json")

if ! echo "$response" | grep -qi "Content-Encoding: gzip"; then
echo "Content-Encoding: gzip not found on client.xsl.sef.json"
exit 1
fi

if ! echo "$response" | grep -q "HTTP/.* 200"; then
echo "client.xsl.sef.json did not return 200 OK"
exit 1
fi
Loading