How to get the original URL of the client front-end with Strapi and Koa?

System Information
  • Strapi Version: 4.1.8
  • Operating System: Ubuntu
  • Database: MySQL / MariaDB
  • Node Version: 16.14.0
  • NPM Version: 8.3.1
  • Yarn Version: 1.22.18

Hello everyone! :upside_down_face:

I have a small question.

I tell you my problem:

  • I have a Strapi backend (strapi.x.com) coupled with two different NextJS frontends on subdomains (front.x, admin.x / localhost:3000 on my computer).
    My problem : I can only define one URL in Strapi settings for the generation of the URL contained in the mail to access the reset-password page of my frontend, while I have two frontends on two different URLs.

So I want to override the forgotPassword method of Strapi to change the part generating the url + code and I would like to get the original URL of the calling front with the Koa context.

I tried with ctx.request.header, ctx.request.url or even ctx.request.origin but without success because each time I get the URL of Strapi (or undefined) and not the one of my calling front.

The idea is to be able to send an email containing the reset link based on this original URL so that I only have to modify this method in Strapi.

Has anyone had this problem? How can I get the URL of the calling frontend from the Koa context (front .x or admin.x)?

I thank you in advance for your answer and wish you a nice day! :slight_smile: