diff --git a/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiService.java b/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiService.java index ab4c7295..6d0225e9 100644 --- a/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiService.java +++ b/code/services-application/api-service/src/main/java/nu/marginalia/api/ApiService.java @@ -79,6 +79,8 @@ public class ApiService extends Service { var license = licenseService.getLicense(request.params("key")); + response.type("application/json"); + var cachedResponse = responseCache.getResults(license, args[0], request.queryString()); if (cachedResponse.isPresent()) { return cachedResponse.get(); @@ -90,7 +92,6 @@ public class ApiService extends Service { // We set content type late because in the case of error, we don't want to tell the client // that the error message is JSON when it is plain text. - response.type("application/json"); return result; } diff --git a/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryService.java b/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryService.java index 9ee4e0d5..42e335eb 100644 --- a/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryService.java +++ b/code/services-core/query-service/src/main/java/nu/marginalia/query/QueryService.java @@ -58,7 +58,7 @@ public class QueryService extends Service { query.specs, rsp.results, query.searchTermsHuman, - List.of(), + List.of(), // no problems query.domain ); } diff --git a/docker-compose.yml b/docker-compose.yml index 7b598755..e5c4e9dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -113,6 +113,7 @@ services: ports: - "127.0.0.1:8080:80" - "127.0.0.1:8081:81" + - "127.0.0.1:8082:82" volumes: - "./run/nginx-site.conf:/etc/nginx/conf.d/default.conf" networks: @@ -175,4 +176,4 @@ volumes: driver_opts: type: none o: bind - device: run/samples \ No newline at end of file + device: run/samples diff --git a/run/nginx-site.conf b/run/nginx-site.conf index 9965a728..a1762990 100644 --- a/run/nginx-site.conf +++ b/run/nginx-site.conf @@ -66,4 +66,23 @@ server { access_log off; } -} \ No newline at end of file +} + +server { + listen 82; + listen [::]:82; + server_name control; + + proxy_set_header X-Context $remote_addr-$connection; + proxy_set_header X-Extern-Url $scheme://$host$request_uri; + proxy_set_header X-Extern-Domain $scheme://$host; + proxy_set_header X-User-Agent $http_user_agent; + + proxy_set_header X-Public "1"; + + location / { + proxy_pass http://api-service:5004/public/; + access_log off; + } + +}