One solution to achieve this would be to use a reverse proxy like Nginx. You can set up Nginx in front of both your frontend and backend Docker containers, and then configure it to route requests to the correct container based on the URL. This would allow you to dynamically change the backend URL in your frontend code, and have Nginx route requests accordingly.

To do this, you would need to modify your docker-compose files to expose the ports for your frontend and backend containers to the host machine. Then, you can set up an Nginx container and mount a configuration file into it that specifies the routes to your frontend and backend containers. Within this configuration file, you can set up a proxy_pass directive that forwards requests to the appropriate backend container based on the URL path.

For example, your Nginx configuration file might look something like this:

```bash
server {
    listen 80;
    server_name example.com;

    location /api {
        proxy_pass http://backend:8000;
    }

    location / {
        proxy_pass http://frontend:3000;
    }
}
```

In this example, Nginx is configured to route requests to /api to the backend container at http://backend:8000, and all other requests to the frontend container at http://frontend:3000. You can then modify your frontend code to make requests to the /api path, and Nginx will route them to the correct backend container.

By using Nginx as a reverse proxy, you can dynamically change the backend URL in your frontend code without having to rebuild your production image. This provides a more elegant and scalable solution for managing your application's configuration.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence