Receiving 404 error on port 443 but not in testing (port 5000) using $.getJSON

Hi All,

I have a flask webserver on my linode, using nginx and gunicorn.

I have been testing the server on port 5000 and in production I have it on 443(ssl).

I am jusing the $.getJSON[https://api.jquery.com/jQuery.getJSON/] method in jquery to pass some data to the server and then receive JSON data to make some plots.

This method worked completely fine while I was testing it out on port 5000. As soon as I go on port 443, I get a 404 error saying """The browser (or proxy) sent a request that this server could not understand."""

This is the command I am sending to the server that returns the 404 error """$.getJSON("historical_data", {"sensor":"ph"})"""

On the backend this is what is receiving the "sensor" value. """sensor = request.args['sensor']"""

I am sending other getJSON requests and they are all working fine. If anyone has any input or has come across this problem before any input would be great!

I've tried adding the full URL to the getJSON request and still nothing.
I've also tried this ajax method to send the json """
$.ajax({
type: "GET",
url : "historical_data",
contentType: 'application/json;charset=UTF-8',
data: {'sensor': 'ph'},
error:function(){alert("server error, reload and try again")},
})
"""

additionally on the backend i Have tried using this command to process the incoming data with the get request, but with no luck. Again, it worked in development on port 5000 but not on port 443

"""sensor = request.args.get('sensor')""

1 Reply

I solved this. In my guincorn app file I changed """proxy_pass http://localhost:8000;""" to """proxy_pass http://127.0.0.1:8000;""" per this post [https://serverfault.com/questions/529394/nginx-connect-failed-111-connection-refused-while-connecting-to-upstream].

I also reloaded supervisor.

I am not sure which of these actions actually fixed the issue, but I am leaning more towards the fact I had to reload the supervisor.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct