POST result: 404

MarcoI nginx-forum at forum.nginx.org
Fri May 1 08:18:10 UTC 2020


It doesn't produce a "404" but it is saying "Cannot POST" ...:

curl -X POST http://127.0.0.1:8080/puser/add
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /puser/add</pre>
</body>
</html>


These are the corresponding lines in /var/log/nginx :  

128.14.134.170 - - [01/May/2020:10:04:03 +0200] "GET / HTTP/1.1" 502 584 "-"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/60.0.3112.113 Safari/537.36"
37.116.208.25 - - [01/May/2020:10:09:53 +0200] "GET / HTTP/2.0" 200 694 "-"
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/81.0.4044.129 Safari/537.36"
37.116.208.25 - - [01/May/2020:10:09:53 +0200] "GET /js/app.js HTTP/2.0" 200
147353 "https://ggc.world/" "Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safar$
37.116.208.25 - - [01/May/2020:10:09:54 +0200] "GET /js/chunk-vendors.js
HTTP/2.0" 200 4241853 "https://ggc.world/" "Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.404$
37.116.208.25 - - [01/May/2020:10:09:54 +0200] "GET
/sockjs-node/info?t=1588320594594 HTTP/2.0" 200 79 "https://ggc.world/"
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/$
37.116.208.25 - - [01/May/2020:10:10:15 +0200] "POST /puser/add HTTP/2.0"
404 137 "https://ggc.world/" "Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/$

And this is the nginx configuration file:

server {
    listen 443 ssl http2 default_server;
    server_name ggc.world;

    ssl_certificate /etc/letsencrypt/live/ggc.world/fullchain.pem; # managed
by Certbot
    ssl_certificate_key /etc/letsencrypt/live/ggc.world/privkey.pem; #
managed by Certbot

    ssl_trusted_certificate /etc/letsencrypt/live/ggc.world/chain.pem;

    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    ssl_session_timeout 5m;
    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers
EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:50m;
    #ssl_stapling on;
    #ssl_stapling_verify on;

    access_log /var/log/nginx/ggcworld-access.log combined;

    add_header Strict-Transport-Security "max-age=31536000";
    location = /favicon.ico { access_log off; log_not_found off; }

    location / {
        proxy_pass http://127.0.0.1:8080;
        #proxy_pass http://127.0.0.1:2000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        #proxy_set_header Host $host;
    }
}

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    error_page 497 https://$host:$server_port$request_uri;
    server_name ggc.world;
    return 301 https://$server_name$request_uri;

    access_log /var/log/nginx/ggcworld-access.log combined;

    add_header Strict-Transport-Security "max-age=31536000";
    location = /favicon.ico { access_log off; log_not_found off; }

    location / {
        proxy_pass http://127.0.0.1:8080;
        #proxy_pass http://127.0.0.1:2000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        #proxy_set_header Host $host;
    }
}

# https://www.nginx.com/blog/nginx-nodejs-websockets-socketio/
# https://gist.github.com/uorat/10b15a32f3ffa3f240662b9b0fefe706
# http://nginx.org/en/docs/stream/ngx_stream_core_module.html

upstream websocket {
    ip_hash;
    server localhost:3000;
}

server {
    listen 81;
    server_name ggc.world;

    #location / {
    location ~ ^/(websocket|websocket\/socket-io) {
        proxy_pass http://127.0.0.1:4201;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwared-For $remote_addr;
        proxy_set_header Host $host;

        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
#
https://stackoverflow.com/questions/40516288/webpack-dev-server-with-nginx-proxy-pass


upstream golang-webserver {
    ip_hash;
    server 127.0.0.1:2000;
}

server {
    listen 2999;
    server_name ggc.world;

    location / {
        #proxy_pass http://127.0.0.1:8080;
        proxy_pass http://golang-webserver;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        #proxy_set_header Host $host;
    }
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,287914,287919#msg-287919



More information about the nginx mailing list