How to set the default connection string in browser?


(Mirto Busico) #1

Hi all,
I'm using neo4j community 3.5
From a remote machine I can reach the browser at the URL

https://192.168.166.206:7473/browser/

The connection panel proposes the connection string

bolt://localhost:7687

Changing the connnection string to

https://192.168.166.206:7473

works fine

The problem is that I have to change the connection string everytime I start the web browser

How can I change permamently the default connection string?

Note: in Firefox and Chromium I cannot use the bolt protocol due to the websocket error


(Michael Hunger) #2

It uses what the database provides as the listen address which is configured in neo4j.conf

curl http://localhost:7474/
{
  "management" : "http://localhost:7474/db/manage/",
  "data" : "http://localhost:7474/db/data/",
  "bolt" : "bolt://localhost:7687"
}

curl https://1cec42ea.databases.neo4j.io/
{
  "management" : "https://1cec42ea.databases.neo4j.io/db/manage/",
  "data" : "https://1cec42ea.databases.neo4j.io/db/data/",
  "bolt" : "bolt://1cec42ea.databases.neo4j.io:7687"
}


(Mirto Busico) #3

Sorry, I was not clear.
I want to change the "Connect URL" field content that is displayed when Firefox open the browser URL without rewriting it everytime I start Firefox


(Paolodipietro58) #4

You can edit the neo4j.conf file, and add the following line undefr bolt configuration:

dbms.connector.bolt.advertised_address=<your_address>:<your_port>

you must specify the port number even if it is the default one (7687)

Don't forget to restart the server.


(Mirto Busico) #5

Well,
with this line added the field connection URL shows correctly

bolt://192.168.166.206:7687

But the connectionfails with the error

ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser

which afaik indicates a certificate problem for a connection started inside an httpsconnection
Changing the URL to theone used before

https://192.168.166.206:7473

gives an error

 Neo.ClientError.Security.Unauthorized: Invalid username or password.

trying to connect again connets to the database (on chromium a popup appears and you have to click cancel)

My network configuration is:

#*****************************************************************
# Network connector configuration
#*****************************************************************

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
dbms.connectors.default_listen_address=0.0.0.0

# You can also choose a specific network interface, and configure a non-default
# port for each connector, by setting their individual listen_address.

# The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or
# it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for
# individual connectors below.
#dbms.connectors.default_advertised_address=192.168.166.206
dbms.connector.bolt.advertised_address=192.168.166.206:7687
dbms.connector.https.advertised_address=192.168.166.206:7473

# You can also choose a specific advertised hostname or IP address, and
# configure an advertised port for each connector, by setting their
# individual advertised_address.

# Bolt connector
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=OPTIONAL
dbms.connector.bolt.listen_address=0.0.0.0:7687

# HTTP Connector. There can be zero or one HTTP connectors.
dbms.connector.http.enabled=true
dbms.connector.http.listen_address=0.0.0.0:7474

# HTTPS Connector. There can be zero or one HTTPS connectors.
dbms.connector.https.enabled=true
dbms.connector.https.listen_address=0.0.0.0:7473

# Number of Neo4j worker threads.
#dbms.threads.worker_count=

Any hint?


(Paolodipietro58) #6

I found several differences in the conf file between neo4j version.

I'm using the latest 3.5.0 CE. What is your version?

This is my network config fragment, and it is running fine. As you can see some default listen address are defaulted (remember, this is for 3.5.0!)

#*****************************************************************
# Network connector configuration
#*****************************************************************

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
dbms.connectors.default_listen_address=0.0.0.0

# You can also choose a specific network interface, and configure a non-default
# port for each connector, by setting their individual listen_address.

# The address at which this server can be reached by its clients. This may be the server's IP address or DNS name, or
# it may be the address of a reverse proxy which sits in front of the server. This setting may be overridden for
# individual connectors below.
dbms.connectors.default_advertised_address=localhost

# You can also choose a specific advertised hostname or IP address, and
# configure an advertised port for each connector, by setting their
# individual advertised_address.

# Bolt connector
dbms.connector.bolt.enabled=true
#dbms.connector.bolt.tls_level=OPTIONAL
#dbms.connector.bolt.listen_address=:7687
dbms.connector.bolt.advertised_address=neo4j:7687

# HTTP Connector. There can be zero or one HTTP connectors.
dbms.connector.http.enabled=true
#dbms.connector.http.listen_address=:7474

# HTTPS Connector. There can be zero or one HTTPS connectors.
dbms.connector.https.enabled=true
#dbms.connector.https.listen_address=:7473

# Number of Neo4j worker threads.
#dbms.threads.worker_count=

(Mirto Busico) #7

Well,
I'm using the linux version on Kubuntu18.04.1 downloaded from here

https://neo4j.com/download-center/#releases

downloaded file name

neo4j-community-3.5.0-unix.tar.gz

The differences in the file are due to the fact that I need to access the database from a different machine
With the default configuration you can only access the database from localhost
Moreover putting only the line

dbms.connectors.default_listen_address=0.0.0.0

doesn't work. To use remotely https strangely you have to add "0.0.0.0" also in the connectors


(Paolodipietro58) #8

This is about http, not https:

If you specify 0.0.0.0 as the default.listen.address, you can access the DB from any machine.
My config file is used on a Ubuntu SERVER machine without a GUI, and I access the DB thru the browser of any machine of my intranet (there is a firewall to avoid others access the DB).

IMHO, you should avoid to use fixed IP addresses and let the DNS do the job.


for https, I know there should be some trouble to config, and maybe you should issue/use some certificates!

if you get a look at the neo4j.conf in the 3.5.0, there are two entire section named SSL system conf and SSL policy configuration after the Network Connector Configuration

There are some will be deprecated there.

I try to config, but after some hours I decide to let the problem when this part of the confg will be more stable.
It will securely change and, for me, it is better to work on the content now, using http.


(Mirto Busico) #9

Ok thanks.

For now I'll avoid https.


(Michael Hunger) #10

You have to accept the certificate of the endpoint once.

Open this in browser. 192.168.166.206:7687 and accept the cert.


(Mirto Busico) #11

Ok. Thanks.
It works fine with HTTP in firefox and BOLT in the connection URL

BTW typing 192.168.166.206:7687(which afaik defaults to http) gives the error

not a WebSocket handshake request: missing upgrade

and bolt://192.168.166.206:7687 is not a protocol recognized by the web browser


(Tshepo Thwala) #12

Hi Can you please help Im a beginner. I cannot establish connection to server. the first time I installed Neo4j it worked very well, now I cant connect to server and I constantly get a connect server error


(Michael Hunger) #13

you need to provide more detail.


(Tshepo Thwala) #14

I did manage to fix it. Thank you for willing to help. :slight_smile:


(Michael Hunger) #15

How did you fix the issue?