Fixing port conflicts and CORS problems
Is the server up but you cannot connect, or does the browser (connect-web) show a CORS error? Checking the port settings and the origin configuration together solves most cases.
Symptoms
- The server reports that the port is already in use at startup.
- The client cannot connect to the server.
- A CORS (Cross-Origin) error appears in the browser console.
Causes
First, let's go over Bareun's port layout.
| Environment | Port | Purpose |
|---|---|---|
| Native installation | 5656 | gRPC/Connect + static resources (can be served on the same port) |
| Docker distribution | 5656 | gRPC/Connect + static resources |
| Cloud | 443 | TLS, API key required |
| Cause | Description |
|---|---|
| Port conflict | Another process already holds the same port |
| Connecting to the wrong port | The client sends requests to a different port |
| CORS not allowed | The browser requested a different origin and it was not allowed |
Solution
-
Check for a port conflict first. If the startup error says "port in use," another process is using the same port. Change
address.portinbareun.json(default5656) to a free port and run the server again.{ "address": { "ipAddr": "0.0.0.0", "port": 5656 }, "staticAddress": { "ipAddr": "0.0.0.0", "port": 5656 } }A restart is needed after changing the port
A port change takes effect only after you run the server again. Also match the port the client requests.
-
Check that the client connects to the right port. Both the native installation and the Docker distribution use the default
5656port (the native installation can also use5658). Check that you are sending requests to the port that fits your environment. -
For browsers (connect-web), check CORS. The
Bareunserver (connect-go) accepts connect-web requests directly and handles CORS itself. No separate proxy is needed. If the web frontend sends requests from an origin different from the server's, check that the server is configured to allow that origin and that the client requests the correct address and port.
0.0.0.0 vs a specific interface
The default of address.ipAddr is 0.0.0.0, which accepts connections on all interfaces. To open only a specific network
interface, you can change it to that host address. When you cannot connect, the binding address is also something to check.
Prevention and tips
- If you run several instances on one host, plan ahead so the ports do not overlap.
- For a setup connected from a browser, you can call the server directly with connect-web. Serving from the same origin or matching the server's allowed-origin setting avoids CORS problems.
Frequently asked questions
Q. How do I change the port if there is a conflict?
Change address.port in bareun.json (default 5656) to a free port and run the server again.
If you serve static resources on the same port, it is also good to match staticAddress.port.
Q. I get a CORS error in the browser.
If you send requests from a different origin with connect-web, CORS handling is needed. The Bareun server handles connect-web and CORS
itself, so check that the server is configured to allow that origin and that the client requests the correct address and port.
If you serve from the same origin, CORS problems do not arise at all.
Q. Are the native and Docker ports the same?
Yes. Both use the default 5656 port. The native installation serves gRPC/Connect and static resources on the same port
(or 5658), and the Docker distribution also serves directly on 5656. The Bareun server (connect-go) handles
gRPC, connect-web, and HTTP+JSON all on one port and takes care of CORS itself, so a separate Envoy
frontend (formerly 5757) and the admin port 9902 are not used.
Q. What is the path when calling with REST (HTTP+JSON)?
Bareun uses Connect paths. Call it in the form POST /bareun.<Service>/<Method> (for example,
POST /bareun.LanguageService/AnalyzeSyntax). The old gateway path (/bareun/api/v1/...) is not used.
It is handled on the same 5656 port together with gRPC and connect-web.
This page has not been fully verified yet
The port and CORS explanations on this page have not been fully verified yet. Behavior may differ by actual environment and version, so use it for reference only. Please check the exact behavior in your production environment, or ask through the Support request channel.