Nginx Bad Request “Malicious Path” on change strapi path

System Information
  • Strapi Version: 3.5.0
  • Operating System: Ubuntu 18.04
  • Database: Postgres
  • Node Version: 12.20.2
  • NPM Version: 6.14.11
  • Yarn Version: 1.22.4

I changed the Digital Ocean Strapi from the root (/) to (/ api) now I get an error message, when entering / api / admin.

I’ve tried all possible configurations, I don’t know if the error comes from nginx or strapi.

Error output:

{
    statusCode: 400,
    error: "Bad Request",
    message: "Malicious Path"
}

My server conf:

server {

# Listen HTTP
    listen 80;
    server_name _;

# Proxy Config
    # Client
    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_pass_request_headers on;
    }

    location /api {
        proxy_pass http://strapi/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Try to use absolute url, like https://yourdomain.com/api