2

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:

enter image description here

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!

2
  • Hi @SupaMario ! when you say you have dockerized Strapi what does your Dockerfile look like...respectively how do you use your Image. Further more do you use a Reverse Proxy? I am asking because I had a similar problem when using strapi/base:14 as Base Image.. Commented Apr 25, 2022 at 13:17
  • @benchvondaranch i used my own custom one, but this error is not related to docker i think. I get the same problem when starting it through npm or yarn locally. Commented Apr 26, 2022 at 6:48

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.