roda
roda copied to clipboard
Swagger not working (cors) in demo deploy
Hi,
The swagger container can not access the openapi.json-file due to cors
I'm using the standard docker-compose.yaml
and docker compose up
Error message from Swagger:
Errors
Hide
Fetch error
Failed to fetch http://localhost:8080/api/openapi.json
Fetch error
Possible cross-origin (CORS) issue? The URL origin (http://localhost:8080) does not match the page (http://localhost:8081). Check the server returns the correct 'Access-Control-Allow-*' headers.
Request with curl:
$ curl -v -s http://localhost:8080/api/openapi.json > /dev/null
* Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /api/openapi.json HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200
< Cache-Control: private
< Set-Cookie: JSESSIONID=715DCA7790998002996D7447CAE9F0BC; Path=/; Secure; HttpOnly; SameSite=Strict
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google.com https://www.google-analytics.com https://www.gstatic.com; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'self';
< X-XSS-Protection: 1; mode=block
< X-Permitted-Cross-Domain-Policies: none
< Feature-Policy: camera 'none'; fullscreen 'self'; geolocation *; microphone 'self'
< X-Frame-Options: SAMEORIGIN
< X-Content-Type-Options: nosniff
< Referrer-Policy: no-referrer
< Permissions-Policy: geolocation=(self)
< Content-Type: application/json
< Transfer-Encoding: chunked
< Date: Thu, 05 Sep 2024 13:04:25 GMT
<
{ [72894 bytes data]
* Connection #0 to host localhost left intact
docker-compose.yaml
---
services:
zoo:
image: docker.io/zookeeper:3.9.2-jre-17
restart: unless-stopped
environment:
- ZOO_4LW_COMMANDS_WHITELIST=mntr,conf,ruok
volumes:
- zookeeper_data:/data
- zookeeper_datalog:/datalog
solr:
image: docker.io/solr:9.5.0
restart: unless-stopped
ports:
- "8983:8983"
environment:
SOLR_HEAP: 2g
ZK_HOST: zoo:2181
command: -c
volumes:
- solr_data:/var/solr
clamd:
image: docker.io/clamav/clamav:1.2.2
restart: unless-stopped
volumes:
- clam_data:/var/lib/clamav
- roda_data:/roda/data/
siegfried:
image: ghcr.io/keeps/siegfried:v1.11.0
restart: unless-stopped
environment:
SIEGFRIED_HOST: 0.0.0.0
SIEGFRIED_PORT: 5138
volumes:
- siegfried_data:/root/siegfried/
- roda_data:/roda/data/
swagger:
image: docker.io/swaggerapi/swagger-ui:v5.13.0
restart: on-failure
ports:
- "8081:8080"
environment:
- URL=http://localhost:8080/api/openapi.json
- DOC_EXPANSION=none
- VALIDATOR_URL=none
roda:
image: ghcr.io/keeps/roda:latest
restart: unless-stopped
ports:
- "8080:8080"
depends_on:
- solr
- clamd
- siegfried
volumes:
- roda_data:/roda/data/
environment:
# Solr Cloud configuration
- RODA_CORE_SOLR_TYPE=CLOUD
- RODA_CORE_SOLR_CLOUD_URLS=zoo:2181
- SOLR_NUM_SHARDS=4
- SOLR_REPLICATION_FACTOR=1
# Base plugin services configuration
- SIEGFRIED_SERVER_URL=http://siegfried:5138
- CLAMD_TCPADDR=clamd
- CLAMD_TCPSOCKET=3310
volumes:
zookeeper_data:
zookeeper_datalog:
solr_data:
clam_data:
siegfried_data:
roda_data:
All containers seem to be working:
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
slask-clamd-1 docker.io/clamav/clamav:1.2.2 "/init" clamd 27 hours ago Up 27 hours (healthy) 3310/tcp, 7357/tcp
slask-roda-1 ghcr.io/keeps/roda:latest "/docker-entrypoint.…" roda 27 hours ago Up 27 hours 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
slask-siegfried-1 ghcr.io/keeps/siegfried:v1.11.0 "/bin/sh -c 'sf -ser…" siegfried 27 hours ago Up 27 hours 5138/tcp
slask-solr-1 docker.io/solr:9.5.0 "docker-entrypoint.s…" solr 27 hours ago Up 27 hours 0.0.0.0:8983->8983/tcp, :::8983->8983/tcp
slask-swagger-1 docker.io/swaggerapi/swagger-ui:v5.13.0 "/docker-entrypoint.…" swagger 27 hours ago Up 27 hours 80/tcp, 0.0.0.0:8081->8080/tcp, :::8081->8080/tcp
slask-zoo-1 docker.io/zookeeper:3.9.2-jre-17 "/docker-entrypoint.…" zoo 27 hours ago Up 27 hours 2181/tcp, 2888/tcp, 3888/tcp, 8080/tcp