How to have different server config on replication server for postgres_fdw?
If you define the foreign server using host and port connection parameters, these data are part of the PostgreSQL metadata and replicated. Streaming replication creates an identical copy of the database.
So you'd have to define the foreign server using connection parameters that refer to a file outside the database proper.
What comes to mind is the service connection parameter. With that, the actual connection parameters are taken from a file pg_service.conf that is outside the database. Then all you have to do is provide a different service file on the standby server.