skip to Main Content

Since this morning I try to simulate a POST request on my remote database with the https protocol because I installed an ssl certificate. (my site is secure).

I have configured the firewalls of my server in this way :

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere
80/tcp                     ALLOW IN    Anywhere
443/tcp                    ALLOW IN    Anywhere
80/tcp (Nginx HTTP)        ALLOW IN    Anywhere
3000                       ALLOW IN    Anywhere
22/tcp (v6)                ALLOW IN    Anywhere (v6)
80/tcp (v6)                ALLOW IN    Anywhere (v6)
443/tcp (v6)               ALLOW IN    Anywhere (v6)
80/tcp (Nginx HTTP (v6))   ALLOW IN    Anywhere (v6)
3000 (v6)                  ALLOW IN    Anywhere (v6)

and here is the default file of nginx :

upstream backend {
        server localhost:3000;
}

server {
  listen 80;
  rewrite ^ https://$host$request_uri? permanent;
}

server {
#        listen 80 default_server;
#        listen [::]:80 default_server;

        listen 443 ssl;

        ssl_certificate /home/debian/site.com.chain.pem;
        ssl_certificate_key /home/debian/myserver.key;

        root /home/debian/site.com/dist;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location  ^~ /api {
               proxy_redirect off;
               proxy_http_version 1.1;
               proxy_pass http://backend;
               proxy_set_header Host $host ;
               proxy_set_header X-Real-IP $remote_addr;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       }


        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

}

Do you know where this can come from ?

2

Answers


  1.  http://ipadress:3000/api/v1/data_tag
    

    This is your internal server, which is not HTTPS enabled. You even access this server explicitly with plain HTTP from your nginx:

               proxy_pass http://backend;
    

    If you want to use the HTTPS configured in nginx, you need to use the port configured for HTTPS in nginx, i.e.

      https://example.com:443/api/v1/data_tag
    

    Or simpler, since 443 is the default port for HTTPS:

      https://example.com/api/v1/data_tag
    

    example.com in this case is the placeholder for your domain which is configured for your server and inside the certificate.

    Login or Signup to reply.
  2. It looks like you have a misconfigured intermediate certificate.
    Verify if site.com.chain.pem has correct content and the path to it is correct.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search