Stream: hapi
Topic: HAPI Docker setup (Solved)
Dexter (Feb 01 2021 at 08:25):
I'm trying to run HAPI, it goes well, but I have this error when making this query
HAPI Version: HAPI FHIR 5.2.0 REST Server (FHIR Server; FHIR 4.0.1/R4)
Sending this request fails localhost:8080/fhir/Patient?identifier=ID_SYSTEM_1|
.
root@hapifhir:/usr/local/tomcat# curl 'localhost:8080/fhir/Patient?identifier=ID_SYSTEM_1|'
<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Invalid character found in the request target [/fhir/Patient?identifier=ID_SYSTEM_1|]. The valid characters are defined in RFC 7230 and RFC 3986</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Invalid character found in the request target [/fhir/Patient?identifier=ID_SYSTEM_1|]. The valid characters are defined in RFC 7230 and RFC 3986
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:486)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.base/java.lang.Thread.run(Thread.java:834)
</pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /><h3>Apache Tomcat/9.0.38</h3></body></html>
This request works on hapi.fhir.org
, so not sure what's the fix
Pulled from standard HAPI docker image, with this configuration
spring:
datasource:
url: 'jdbc:h2:file:./target/database/h2'
username: sa
password: null
driverClassName: org.h2.Driver
max-active: 15
batch:
job:
enabled: false
hapi:
fhir:
fhir_version: R4
default_encoding: JSON
default_pretty_print: false
tester:
home:
name: Local Tester
server_address: 'http://localhost:8080/fhir'
refuse_to_fetch_third_party_urls: false
fhir_version: R4
Dexter (Feb 02 2021 at 10:32):
Solved
I managed to fix it, I changed server.xml
and used docker configs
section to override the server.xml.
In particular, I made this change, added relaxedQueryChars='|'
.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" relaxedQueryChars='|'/>
Last updated: Apr 12 2022 at 19:14 UTC