i have a really strange behavour. I dockerized my Strapi CMS App and everything worked fine until a few days ago. Now i cannot start the application without getting the following error on loading:
In console:
[2022-04-25 11:40:11.922] error: Malicious Path BadRequestError: Malicious Path
at resolvePath (MY_PATH/backend/node_modules/resolve-path/index.js:78:11)
In Browser:
It calls the following URL:
http://0.0.0.0:1337//admin/init
I noticed the // after the port. When i curl http://0.0.0.0:1337/admin/init i get the following response:
{"data":{"uuid":"SOME_UUID","hasAdmin":true}}
But that doesnt help me.
This is my server.js:
module.exports = ({ env }) => ({
host: env('HOST'),
port: env.int('BACKEND_PORT'),
//url: env("PUBLIC_URL"),
app: {
keys: env.array('APP_KEYS'),
},
});
In my .env file is set the following:
HOST=localhost
BACKEND_PORT=1337
It would be awesome if anyone could help me, i am stuck with this problem for a few days. :/ Thank you!
After testing a loooot of stuff i was really with my latin at the end, like we germans like to say for "i have absolutely no idea what is going on here". So at some point i thought this was a bug within strapi. After heavy weird "hooking into my node_modules and editing urls their" i realized, that when i use docker-compose to spin up my containers there is some kind of cache even if i rebuild the images.
So i started docker compose with:
docker-compose up --build -d
So turned out a few days ago i added a backslash to the STRAPI_ADMIN_BACKEND_URL and/or PUBLIC_URL environment variable and this was some kind of cached the whole time..
So if you have the same problem, make sure that your .env file inside your docker container is correct and do compose with the --build flag to make sure everything is builded new until you fixed your bug. You can also exec -it into the container als check with nano how the .env file looks.
Hope this saves someone some time.