Replies: 2 comments
-
Looking at your configuration, it doesn't seem like worker mode is enabled (to enable it you have to define a worker script). |
Beta Was this translation helpful? Give feedback.
-
Are you setting this via an environment variable by chance? There's a really weird PHP bug that I've been chasing down off-and-on for months now. If so, are you using The bug I am chasing down in php-src and it looks like this (though this simple of a script won't reproduce the issue, otherwise I'd have fixed it by now): echo $_ENV['SOME_VAR'];
function test() {
echo $_ENV['SOME_VAR'];
}
test(); Two different values will be output from other threads, and it only affects |
Beta Was this translation helpful? Give feedback.
-
We are using
Apiplatform 3.3.11
Background:
In our staging environment, we encounter a recurring issue with FrankenPHP that seems to occur every 20th request. The frontend team develops locally, sending requests from localhost:3000 to the staging backend, while the staging frontend also sends requests to the same backend. To ensure proper operation, we configure CORS in NelmioCorsBundle with the following setting:
CORS_ALLOW_ORIGIN="^(https|http)?://(localhost|127.0.0.1|stage.sales.qwe.ru)(:[0-9]+)?$"
Observed Issue:
Approximately every 20th request fails during local development and on the staging environment. It appears that FrankenPHP might be pooling requests from both localhost:3000 and the staging environment (stage.sales.qwe.ru). The failed requests seem to return incorrect CORS headers, such as Allow: localhost:3000, when the response is meant for staging.
Questions for Discussion:
Preventing Worker Pool Mixing:
How can we configure FrankenPHP to segregate worker pools based on the source of requests? Specifically, how can it differentiate requests originating from localhost:3000 versus those from stage.sales.qwe.ru?
Switching Workers to CGI Mode:
Is it possible to switch FrankenPHP’s mode of operation from worker-based to CGI? If so, what are the recommended steps to achieve this?
CORS Header Configuration:
Beyond setting Access-Control-Allow-Origin: *, what are the best practices to ensure correct CORS headers are served based on the request’s origin? Can FrankenPHP or Caddy help dynamically adjust CORS headers for each request?
Current FrankenPHP and Caddy Configuration:
Here is the configuration we are currently using:
Caddy Configuration
Objective:
Our goal is to:
Resolve the intermittent CORS issue without resorting to overly permissive settings like Access-Control-Allow-Origin: *.
Understand and, if necessary, modify FrankenPHP’s request handling to prevent mixing of request pools.
Explore alternatives to worker mode for handling PHP requests to avoid these conflicts.
Your insights and recommendations would be invaluable in helping us address this challenge effectively.
its ok
i dont understand what is it
Beta Was this translation helpful? Give feedback.
All reactions