1. Caddy version (caddy version
):
v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=
2. How I run Caddy:
a. System environment:
FROM caddy:2.2.1-builder AS builder
RUN xcaddy build \
--with github.com/gamalan/caddy-tlsredis
FROM caddy:2.2.1-alpine
RUN apk add --no-cache \
ca-certificates curl \
&& rm -rf /tmp/* \
&& rm -rf /var/cache/apk/*
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
I have some additional code that copies over the config file on container startup and does some checks but otherwise should have no effect on execution.
b. Command:
caddy run --watch --config "$filePrefix/build/configs/turbokivaweb/migration.caddy" --adapter caddyfile
c. Service/unit/compose file:
version: "3.4"
services:
turbokivaweb:
build:
context: ..
dockerfile: build/dockerfiles/caddy.dockerfile # See above
ports:
- "8088:8088"
links:
- php
php:
build:
context: ..
dockerfile: build/dockerfiles/php.dockerfile # php:8-fpm-alpine with some extensions installed
d. My complete Caddyfile or JSON config:
(turbokivaweb) {
encode gzip
handle {
php_fastcgi php{$web_upstreamSuffix}:9000
}
handle_errors {
rewrite * /static/errorPages/general.html
templates
file_server
}
}
:8088 {
import turbokivaweb
}
3. The problem I’m having:
I am trying to POST a form to a PHP script. It seems caddy never logs the request and PHP never receives the request. There are no errors on the client like connection refused or connection closed; it just hangs waiting for a response.
Here’s the distilled client: http://cybercoment.com/temp/vertxtest%20cleaned.zip
Relevant code:
Vertx vertx = Vertx.vertx();
MultiMap values = MultiMap.caseInsensitiveMultiMap();
values.add("field1", "value1");
values.add("field2", "value2");
final WebClient client = WebClient.create(vertx);
final HttpRequest<Buffer> request = client.post(8088, "localhost", "/");
System.out.println("Sending request");
final HttpResponse<Buffer> response = request
.rxSendForm(values)
.blockingGet();
System.out.println("Response received:");
Run with gradle run
Actual output:
cosmotic@Hank~/Desktop/vertxtest/:gradle run
> Task :run
Java 14.0.1
Sending request
<=========----> 75% EXECUTING [46s]
> :run
Expected output:
cosmotic@Hank~/Desktop/vertxtest/:gradle run
> Task :run
Java 14.0.1
Sending request
<=========----> 75% EXECUTING [46s]
> :run
Response received:
[...]
I tested this sample code against google.com and it responds which indicates to me that it’s not the client code.
4. Error messages and/or full log output:
No errors or log entries from caddy, php, or client after making request.
5. What I already tried:
All other requests through caddy to php work fine.
I tried using wireshark between the client and the server to and get this request:
POST / HTTP/1.1
user-agent: Vert.x-WebClient/4.0.0
content-type: application/x-www-form-urlencoded
host: localhost:8088
transfer-encoding: chunked
1b
field1=value1&field2=value2
0
I tried attaching a breakpoint in PHP (and verified working xdebug beforehand) and no luck; the breakpoint is never hit.
6. Links to relevant resources:
The first few ways I was looking at it through wireshark I didnt see the chunk sizes but they were there; it resulted in this bug report with vertx but I was mistaken.
https://github.com/vert-x3/vertx-web/issues/1818