We have an internal and some external domains for the accesses to our websites. Normally the internal domain is not rewritten via Apache.
With the internal domain backend and frontend (Development Mode) can start like this:
RAZZLE_DEV_PROXY_API_PATH=http://0.0.0.0:8092 make start-backend &
RAZZLE_DEV_PROXY_API_PATH=http://internal.foo.de:8092/Plone HOST=internal.foo.de make start-frontend
But when I want to reach the frontend externally, it doesn't work. Maybe it's my apacheconfig, or the start command via yarn, or both. I had oriented myself to this:
The upper part with the API for the backend had worked. The lower part does not really work. With that also the port 3000 is not really rewritten. I am also not sure with which variables I should execute the start:prod. I have already tried different things with the variables and with the apacheconfig.
As a result I have in any case the problem that the frontend can not reach the backend. Mostly because of CORS errors.
It seems to me that you're complicating the whole thing. If you're just starting with Volto, try to make your setup simpler. Mixing in Apache, running things on different servers, seems complicated, unless you have a good understanding of how to setup the communication between them.
Maybe I didn't describe my setup that well. Everything runs on our web server. There is no mix between servers here.
On the web server are already running several websites with Plone 5 which can be reached without problems via Apache.
Only the new Plone 6 website we can't reach via Apache.
When I start the yarn build and start:prod for the internal URL the frontend is reachable via http://internal.foo.de:3000:
At your place, I would setup detailed logging (for Apache)
and then look into the log files to find out where the requests fail.
The Apache log config should be such that Apache logs its rewrite
activity. In (one of) its log file, you can then see how
Apache has rewritten the incoming requests.
In Plone's Z2.log, you can see which requests arrived at the backend
and with what status code they ended (2xx means success, 3xx usually
indicate special (maybe partial) success cases; other codes indicate
errors).
If you see requests with error status, you can look at Plone's
primary log file (--> event.log, near the Z2.log),
or get details via the ZMI from one of the error_log objects
(one in the root, one in your Plone instance).
Plone's error logging is controlled by those error_log objects.
By default, the ignore some kind of errors/exceptions;
a reconfiguration might be necessary to get all errors/exceptions logged.
Note that your "API_PATH" configuration is different for
the working case (it ends in Plone) and the non working case
(it lacks Plone and ends in api).
Your Apache config does not look for /api but for /++api++.
Check which requests arrive at the Apache and whether your rewrite rule
handling the api case fires when it should.
Thanks for the tips. I was able to solve the problem. The main problem was that I had used the wrong variable for the production environment. Correct is RAZZLE_API_PATH and not RAZZLE_DEV_PROXY_API_PATH