Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

baseURL is not working #39

Closed
ajankowy035 opened this issue Oct 21, 2022 · 5 comments · Fixed by #60
Closed

baseURL is not working #39

ajankowy035 opened this issue Oct 21, 2022 · 5 comments · Fixed by #60

Comments

@ajankowy035
Copy link

ajankowy035 commented Oct 21, 2022

Hi guys! I am currently working with strapi v4 and we have implemented this CKEditor which has great features. However I am facing a problem with this baseURL configuration which is not working properly IMO. Or I am doing something wrong.
So I provided changes according to your documentation:
Zrzut ekranu 2022-10-21 o 10 32 32

My config/api.js

module.exports = ({ env }) => ({
  baseURL: env('PUBLIC_URL', 'http://localhost:1337'),
});

The result:

Zrzut ekranu 2022-10-21 o 10 55 54

So after adding adding baseURL to config/api.js nothing is happening and sources for uploaded images inside text editor are not prefixed with provided URL.

Is there any possible solution for that issue?

@dannyrippon
Copy link

@ajankowy035 did you find a fix for this? Im also having issues

@ajankowy035
Copy link
Author

no, I didn't find a fix for that. We found another way - using nginx on frontend - we created a redirection to the strapi app when it's calling /uploads

@hypong
Copy link

hypong commented Dec 5, 2022

Does anyone know the solution to this?

@ajankowy035
Copy link
Author

@hypong Maybe you could try to transform the response with controller in strapi? controllers

@jacobedawson
Copy link

If anyone is wondering, adding a "url" property to the module under server.js (./config/server.js) in the Strapi folder did the trick, here is what the config looks like:

module.exports = ({ env }) => ({
  host: env("HOST", "0.0.0.0"),
  port: env.int("PORT", 1337),
  url: env("PUBLIC_URL", "http://localhost:1337"), // <- ADDING THIS LINE TO THE CONFIG
  app: {
    keys: env.array("APP_KEYS"),
  },
});

I tried both methods, and adding the baseURL property to the .config/api.js file did nothing. You could use process.env in a ternary condition if you want to have the url adjusted based on the server environment.

@nshenderov nshenderov linked a pull request Jan 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants