Skip to content

[Resolved] Apache2 proxy server throught Unix Domain Socket to Node.JS http server process #1264

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

Closed
reinaldorauch opened this issue May 10, 2018 · 2 comments

Comments

@reinaldorauch
Copy link

  • Node.js Version: 9.11.1
  • OS: Debian 9.4 Linux 4.9.0-6-amd64 Update README for help #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
  • Scope (install, code, runtime, meta, other?): Runtime
  • Module (and version) (if relevant): HTTP

I have a nodejs server running with http and I want to it to listen to a Unix Domain Socket to bypass the host network stack to a proxy http server, apache2 in case.

It works fine until I make the apache2 server proxy the requests to the nodejs process throught the UDS because when I do that the proxy server returns 503 Service Unavailable. I checked the path for the socket (/tmp/tcu.sock) and it has the same user as the apache2 http proxy server (www-data) and I as root user can use curl (curl -XGET --unix-socket /tmp/tcu.sock http://tcu-api.tcentral.local/ping) to query the nodejs process and get the correct response.

I think it seems to be nodejs related as I runned the netstat --protocol=unix command and I didn't found the nodejs process listening to the socket and I'm sure that the nodejs process is running as I made it managed by systemd.

How I can resolve that?

Thanks for the attention.

@gireeshpunathil
Copy link
Member

can you share a minimal code that represent your server, especially the area around the server creation and the UDS binding.

@reinaldorauch
Copy link
Author

I think I found the problem. I was creating the socket at /tmp folder. It has root user as owner and I think it is that that was blocking apache2 to read/write to it. I created the socket at a folder that has ownership of the apache2 user and it then worked.

Thanks for your attention @gireeshpunathil and sorry for any trouble. Will close the issue as I resolved it.

@reinaldorauch reinaldorauch changed the title Apache2 proxy server throught Unix Domain Socket to Node.JS http server process [Resolved] Apache2 proxy server throught Unix Domain Socket to Node.JS http server process May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants