Hi @SorinGFS
With regards to the editor, I would imagine so as Discourse is open source:
Now onto the prefixing issue, I’ll admit this will be slightly complicated, to get a full view of what is required I would suggest you see the Optional Software part of the documentation. In my below explanation I will be referencing Nginx, but any proxy application can apply here including Traefik, Apache, and others that we don’t have guides for.
The short answer is Strapi itself doesn’t prefix anything, and the backend expects the requested routes to not have a prefix (due to how we manage Koa-Router). What each of the optional software guide does is accept these prefixed routes, strip the prefix, and proxy the request to Strapi.
So with Nginx via the following line, in the sub-folder examples:
rewrite ^/api/(.*)$ /$1 break;
All that does is accept incoming requests on example.com/api
, strips the /api
and passes the request off to Strapi. So taking the example of example.com/api/blog-posts?_sort=created_at:desc
what will be sent to Strapi is instead /blog-posts?_sort=created_at:desc
That server.js url
key is also used all over the rest of the application to let other parts know what it’s “public” URL is, effectively it doesn’t actually modify the Koa-router (not to be confused with the server.js admin.url
which does actually tweak the router for the Admin panel address).
When you set that server.js url
key to /api
what you are telling it is that Strapi can be accessed publicly at HOST:PORT/api
though Strapi is expecting something before it to strip that /api
from the actual request. What it does do is set the Admin panel to request the Strapi backend at HOST:PORT/api
since it’s client side rendered.
Let me know if that makes sense or if I need to clarify something, to be very specific, there is no way internally to prefix all routes automatically, you would effectively need to modify every single routes.json
file, including plugins, with the prefix. that makes things quite complicated, just as us tweaking Koa-router makes the internals quite ugly.