coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
34.14k stars 1.84k forks source link

[Bug]: CheckProxy doesn't respect different ports #2878

Open commandodev opened 3 months ago

commandodev commented 3 months ago

Description

/app/Actions/Proxy/CheckProxy.php has the following code:

            $connection80 = @fsockopen($ip, '80');
            $connection443 = @fsockopen($ip, '443');
            $port80 = is_resource($connection80) && fclose($connection80);
            $port443 = is_resource($connection443) && fclose($connection443);
            if ($port80) {
                if ($fromUI) {
                    throw new \Exception("Port 80 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
                } else {
                    return false;
                }
            }
            if ($port443) {
                if ($fromUI) {
                    throw new \Exception("Port 443 is in use.<br>You must stop the process using this port.<br>Docs: <a target='_blank' href='https://coolify.io/docs'>https://coolify.io/docs</a><br>Discord: <a target='_blank' href='https://coollabs.io/discord'>https://coollabs.io/discord</a>");
                } else {
                    return false;
                }
            }

If I want to run my proxy on different ports (because I already serve nginx as a reverse proxy on the same machine for instance) I assumed that I could change the port mappings in the proxy config, but it seems this step is still unhappy.

Minimal Reproduction (if possible, example repository)

Should work like this everywhere I guess

Exception or Error

Port 80 is in use.
You must stop the process using this port.
Docs: https://coolify.io/docs
Discord: https://coollabs.io/discord

Version

v4.0.0-beta.315

fabioallexandr3 commented 3 months ago

I'm having the same problem, and it happens both for cloud and self-hosted.

RodgerCodes commented 3 months ago

Also having the same issue here

nikolaischunk commented 2 months ago

I have the same problem

international-omelette commented 2 months ago

same here..

laakal commented 2 months ago

Because an Nginx-like app using port 80 is running on the server.

jesusantguerrero commented 1 month ago

Same here, I cant stop the nginx becase is used in production and I want to use coolify in parallel

laakal commented 1 month ago

Remove nginx and use caddy for both prod and coolify.

jesusantguerrero commented 1 month ago

Remove nginx and use caddy for both prod and coolify.

If this was a valid option why we would bother to create the issue in the first place sir?

skornel02 commented 1 month ago

I ran into the same problem, when trying to put Coolify behind a reverse proxy.

Interestingly this check does not run after cliking the "Switch Proxy" button and then Coolify's proxy starts properly.