Strapi backendURL

Can someone give a help there!
I have the strapi running on AWS but the domain I’m using for the application has a context to access.
Exp.: https:// mystrapiapi.com/ my-contexto
But when I’m trying to access the admin, I’m getting this error:

Request URL: https://mystrapiapi.com/my-contexto/admin/init
Request Method: GET
Status Code: 404

Request URL: /my-contexto/admin/register-admin
Request Method: POST
Status Code: 405
16:54

Have you configured a proxy service like Nginx?

No, I have a load balancer

Can you be a bit more specific? For sub-folder based applications like that you need to be able to do URL rewrites at that LB/Proxy layer as Strapi doesn’t dynamically update the koa-router paths.

In my infrastructure I have a bastion host, I hit it and it redirects to a VPC where my machine is, my strapi api can’t not access, because thay try to access “/admin/init”, but I have the context first “/my-context-admin”

1 Like

Hi, I just won a battle with Strapi’s missing admin/init, and want to share my story - maybe it will help some folks in a near future.

I have a frontend developed with Next.js that’s fetching data from Strapi using simple fetch in /pages/api/content/[request].js. The integration with Strapi was tested on my local machine and it worked well. Sadly, when deployed using Nginx’ reverse proxy Strapi’s /admin page failed to load (Next showed it’s 404 page), but the data was fetched successfully. Strange.

I had tested various approaches (including loading Strapi from sub-directory), read nginx-proxy section in Strapi’s documentation a bunch of times, and the best I had achieved was missing admin/init when trying to access /dashboard(configured both on nginx and config/server.js). So, finally, I tried something, that should not change anything - change Strapi’s path from some-path to just somepath. And it worked.

TL;DR in my case the - in Strapi’s URL was the problem. I still don’t know if it was Next’s doing or Strapi’s fault (I don’t blame nginx for this tho), but it’s worth to check it out.

So, my advice with admin/init 404 is to remove - from your URL, if you have any, and then check again.

In my case I don’t have any nginx to do that, I am using strapi start to run the application, I just create a subdominio resolve the issue.
I just create a myapp-strapi.mydomain.com