Skip to content
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

NEO4J + traefik proxy Issues #907

Closed
siharris opened this issue Nov 27, 2016 · 1 comment
Closed

NEO4J + traefik proxy Issues #907

siharris opened this issue Nov 27, 2016 · 1 comment

Comments

@siharris
Copy link

I've been using traefik to proxy an nginx docker container and all works perfectly. When i try neo4j container it doesn't work giving me a 404 page not found. I curl'd the URL and interestingly it responds with

StatusCode : 200
StatusDescription : OK
Content : {
"management" : "http://localhost/db/manage/",
"data" : "http://localhost/db/data/"
}
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 90
Content-Type: application/json; charset=UTF-8
Date: Fri, 25 Nov 2016 06:28:35 GMT
Server: Jetty(9.2.9.v20150224)

                {
                  "manageme...

Forms : {}
Headers : {[Access-Control-Allow-Origin, *], [Content-Length, 90], [Content-Type, application/json;
charset=UTF-8], [Date, Fri, 25 Nov 2016 06:28:35 GMT]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 90

I then ran a non-proxyed docker instance of neo4j and it works fine and also returns the same response as above , although 10 bytes larger

StatusCode : 200
StatusDescription : OK
Content : {
"management" : "http://localhost:7474/db/manage/",
"data" : "http://localhost:7474/db/data/"
}
RawContent : HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 100
Content-Type: application/json; charset=UTF-8
Date: Fri, 25 Nov 2016 06:29:11 GMT
Server: Jetty(9.2.9.v20150224)

                {
                  "managem...

Forms : {}
Headers : {[Access-Control-Allow-Origin, *], [Content-Length, 100], [Content-Type, application/json;
charset=UTF-8], [Date, Fri, 25 Nov 2016 06:29:11 GMT]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 100

I used the test docker compose example setup on the traefik site as a basis config and added the sections below :-

neo4j:
image: neo4j:2.3
labels:
- "traefik.backend=neo4j"
- "traefik.frontend.rule=PathStrip: /neo4j"
- "traefik.port=7474"
- "traefik.frontend.entryPoints=http"

nginx2:
image: nginx
labels:
- "traefik.backend=nginx2"
- "traefik.frontend.rule=PathStrip: /nginx2"
- "traefik.port=80"
- "traefix.port=443"
- "traefik.frontend.entryPoints=http"

I think its something to do with the Content Type being application/json. Have i got the config wrong or is this something anyone has encountered. Setup is on WIndows 10 running docker for WIndows.

@trecloux
Copy link
Contributor

@siharris You are using a PathStrip rule to route requests to your neo4j backend, so I guess that you try to use the URL : http://localhost/neo4j the problem is that neo4j tries to redirect you to the web console : http://localhost/browser but this URL can' be routed by Traefik.

There is may be a workaround in neo4j configuration to make him aware that it's public URL use the /neo4j prefix.

But the simplest solution is to use hostname based routing :

  • replace "traefik.frontend.rule=PathStrip: /neo4j" with "traefik.frontend.rule=Host:neo4j.localhost"
  • make sure that the name neo4j.localhost is resolved to your machine
  • use neo4j with this URL : http://neo4j.localhost

@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants