POST requests hang forever
I'm trying to deploy my app using
caddy
as a reverse proxy. My Tanstack Start app (behind fastify) works fine using docker
but as soon as I add caddy:
where Caddyfile is:
then GET requests work fine (even files) but POST requests hang forever.
Does anyone have any idea what could cause this?15 Replies
correct-apricotOP•7d ago
The POST request reaches fastify for sure (since I see a
incoming request
log in Fastify). It's a POST request made by Tanstack Query (using the native integration with Tanstack Start) to a server function. If I add a console.info
to the start of the function it never gets executed.
Without the proxy the app works just fine (including post requests and even file uploads)correct-apricotOP•7d ago
This is the Fastify server file. Probably not the source of the issue but might as well...
harsh-harlequin•7d ago
can you provide a full reproducer project that is easily runnable?
correct-apricotOP•7d ago
@Manuel Schiller Yup, here it is: https://github.com/shoooe/tanstack-start-fastify/pull/2
GitHub
chore: POST request hanging by shoooe · Pull Request #2 · shoooe/...
Steps to reproduce
Run docker compose up --build --force-recreate
Go to localhost:3000 (home page)
Click "Run POST request"
Notice the POST request hangs forever
harsh-harlequin•7d ago
can you please create a github issue for this in the router repo?
otherwise its hard to track all the open topics
correct-apricotOP•7d ago
Yup. I wasn't sure it was a bug
harsh-harlequin•7d ago
i dont know either
but if in doubt, just create an issue with a reproducer
we will eventually figure it out
correct-apricotOP•7d ago
GitHub
POST requests hang forever when behind a proxy · Issue #5275 · Ta...
Which project does this relate to? Router Describe the bug The Tanstack Start app works just fine without a reverse proxy. As soon as I add a simple reverse proxy (Caddy) then GET requests keep wor...
correct-apricotOP•7d ago
Seems like Caddy is not the issue. Seems like
toNodeHandler
is the culprit. It's reproducible even in a regular pnpm build && pnpm start
nowharsh-harlequin•7d ago
can you reproduce outside of start?
with just toNodeHandler and a dummy handler?
correct-apricotOP•7d ago
What's the dummiest handler?
?
harsh-harlequin•7d ago
thats very dummy!
might want to try a async version as well if that does not fail
correct-apricotOP•7d ago
It's not reproducible neither with that nor with the async version of that
Seems like
toNodeHandler
+ import handler from "@tanstack/react-start/server-entry"
is the problem
It's reproducible even without input data (although Tanstack Start seems to send something anyway)harsh-harlequin•7d ago
It's reproduciblewith or without start?
correct-apricotOP•7d ago
with start
it's only reproducible when you mix
toNodeHandler
and @tanstack/react-start/server-entry
oh yeah and then there's the whole cross site request thing as well (if you are thinking about using GET for mutations)