Standalone mode runtime remotePattern #77499
-
I know this is a very age question, currently the standalone will inline the remotePattern to Things I tried. Manually tamper the
and it did pick up the HOST env and not prevent loading the image. But what is the downside of it? I know there must be some reason why nextjs not doing this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
On a technical level, there really isn't an issue tampering with the server.js file, as it will never be accessible to clients. However, I would strongly advise against doing so, as next uses these patterns as a security boundary. If you're dynamically changing them, you need to be very careful about validating the environment variables to prevent unintended domains from being allowed. Also, messing with build output files such as server.js can be a maintenance burden, and just isn't the recommended approach. Hope that helps 👍 |
Beta Was this translation helpful? Give feedback.
On a technical level, there really isn't an issue tampering with the server.js file, as it will never be accessible to clients. However, I would strongly advise against doing so, as next uses these patterns as a security boundary. If you're dynamically changing them, you need to be very careful about validating the environment variables to prevent unintended domains from being allowed. Also, messing with build output files such as server.js can be a maintenance burden, and just isn't the recommended approach. Hope that helps 👍