-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy to unix:
socket
#406
Comments
Correct, unix sockets are only implemented for the |
Yay! Time to learn Go then! 👍 |
Sure :) This is how fastcgi does it: https://github.com/mholt/caddy/blob/47c5b6c9c40200cb7483bb890ac3a0e092771021/middleware/fastcgi/fastcgi.go#L126-L133 |
I'll give it a try. That doesn't look too complicated. |
Status reportI've made some changes that seem to work. Using this Caddyfile and running both added JavaScript files gives both responses,
I'm not sure if what I did is exactly what I should be doing, but strangely, it works, so I thought I might share my solution with you so we could talk about the changes I spent my whole day now on to work on the rough edges before I start working on As I said, I'm fairly new to Go, though not to programming, and just for the record, I don't think I will use Go very often in the future. Go is so weird. 😊 |
Looks like we are not far off 👏 If you are gonna create a PR, you will need to remove the gitignore and js files from the commit and a rebase to single commit will be preferred. Thanks 😊 |
Sure, I'll cleanup before submitting a PR! 👍 The JavaScript files were meant for tests, the |
Status reportI was able to refine my changes, clean everything up, remove the garbage and squash everything together: master...eiszfuchs:feature/proxy-socket It's still lacking tests, because I've got no clue how to start writing these. :( |
Nice, we can prove they work with some tests. You can do that with net.Listen and specify "unix" as the socket type. Will probably need to take care that such tests do not fail to compile or run on Windows, as well. Looking good so far! |
👍 <3 |
Then let's move the discussion to a proper Pull request, shall we? |
I'm currently writing a blog post as I try to replace
nginx
with Caddy step by step. My current setup is that I have a bunch of Python applications that I bind tounix:
sockets* using gunicorn.From what I understand, gunicorn isn't exactly FastCGI, so I had to use Caddy's
proxy
directive.This doesn't work as I would expect. I believe because it hasn't been implemented yet.
The socket file is owned by the same user Caddy is running under. Yet the only response I get is
502 Bad Gateway
.Am I missing something or is this hereby considered a feature request?
* I'm using sockets instead of ports because I hate having a spreadsheet with all the ports I use. Sockets are easier to organize.
The text was updated successfully, but these errors were encountered: