Content type returning 404 for rest endpoint

When connecting to n8n the workflow screen immediately dies with a 404 message and when capturing requests the n8n.example.com/rest/put?sessionId=something request returns a 404 message with

Cannot GET /rest/push

However if I change the header value of the request from
Accept: text/event-stream
to
Accept: text/html
I get a 200 response. I have Nginx in front of n8n but I can’t spot anything in the setup that would cause this. The request is obviously making its way to n8n for it to return that response in the 404.

Anyone run into anything like this before?

Welcome to the community @lathanar!

Have never seen this problem before. Did you try if it works without nginx? Because maybe the configuration is wrong.

If it works directly but not via nginx we know at least that the problem lies there. In this case it is best to look in this forum for “nginx”. There are already some existing topics like this one with an example configuration:

I fixed it a little bit ago. I was setting the endpoint url via the config file using the format

endpoints: {
	rest: 'https://n8n.exmaple.com/rest'
},

and while it looked like that was working, it just caused the issue described. If I set the proxy_set_header Accept: in nginx to add in the type it started working for the rest calls but other calls started failing.

I ended up removing the config file entries and just working with pm2 to set the VUE_APP_URL_BASE_API variable, removing the Accept entry in Nginx and that ended up fixing the communication issue.