Restriction of a branched cover to its branch locus Assume that we have a smooth, compact, complex surface $X$, and a smooth and irreducible divisor $B \subset X$. Let $G$ be a finite group. For every group epimorphism $$\varphi \colon \pi_1(X-B) \to G,$$ by Grauert-Remmert extension theorem  there is a smooth complex surface $Y$ and a Galois cover $$f \colon Y \to X,$$
with Galois group $G$ and branched at most over $B$.
Since $B$ is smooth, setting $R =f^{-1}(B) \subset Y$ we see that the restriction $$f|_R \colon R \to B$$ is an unramified Galois cover, with Galois group $H=G/G_R$, where $G_R$ is the stabilizer of the curve  $R$. Such a Galois cover must correspond in turn to a group homomorphism $$\psi \colon \pi_1(B) \to H,$$ that is surjective if and only if $R$ is irreducible.

Question. How we can recover, in a purely algebraic way, the map $\psi$ from $\varphi$ and from the homomorphisms (induced by the inclusion maps) $$i_* \colon \pi_1(X-B) \to \pi_1(X), \quad j_* \colon \pi_1(B) \to \pi_1(X)?$$

Here "in a purely algebraic way" means (for instance) that, if I have implemented the three homomorphisms $\varphi \colon \pi_1(X-B) \to G$, $i_*$ and $j_*$ in a software like GAP4, there should be, at least in principle, a finite sequence of commands providing $\psi \colon \pi_1(B) \to H$.
I expect this to be possible, since $\varphi$ completely determines $f \colon Y \to X$, and so completely determines the restriction $f|_R \colon R \to B$.
 A: Here is an algebraic version of Allan Edmonds' answer which supplements my original post (see below).
Let $\eta\in B$ be the generic point, and let $A$ be the complete local ring of $\eta\in X$, so $A$ is a complete discrete valuation ring; let $\mathfrak{m}$ be its maximal ideal, $k = A/\mathfrak{m}$ its residue field (ie, the function field of $B$), and $K$ be its fraction field. Since $R\rightarrow B$ is etale and $B$ is smooth irreducible, $R$ is also smooth, so its connected or irreducible components are in bijection with its generic points. Let $\epsilon\in R$ be a generic point with associated geometric point $\overline{\epsilon}$, and let $R_1\subset R$ be the corresponding component. Let $L$ be the fraction field of the complete local ring at $\epsilon$, then $Gal(L/K) = G_\epsilon := Stab_G(\epsilon)$ and the inertia group of $L/K$ is $G_{\overline{\epsilon}} := Stab_G(\overline{\epsilon})$. It follows that the $R_1/B$ is Galois with Galois group $G_\epsilon/G_{\overline{\epsilon}}$, which agrees with my original post (below).
By the Cohen structure theorem, we can identify $K = k((t))$. The analogue to Allan Edmonds' homotopy exact sequence is then the short exact sequence of etale fundamental groups
$$1\longrightarrow \pi_1(\text{Spec }\overline{k}((t)))\longrightarrow \pi_1(\text{Spec }k((t)))\longrightarrow\pi_1(\text{Spec }k)\longrightarrow 1$$
(base points are given by $\overline{k((t))}$), and since $k$ contains all roots of unity, this is a central extension (which agrees with Allan Edmond's observation).
The analogue to Allan's maps "$i_*$" and "$j_*$" can be given as follows: Let $K' = \overline{k}((t))$, then we have maps
$$\text{Spec }K'\longrightarrow \text{Spec }K\longrightarrow X - B$$
The induced map $\pi_1(\text{Spec }K')\rightarrow \pi_1(X-B)$ (with base point the geometric point given by $\overline{k((t))}$) is the analogue of Allan's "$i_*$", and the map $\pi_1(\text{Spec }K)\rightarrow \pi_1(X-B)$ is the analogue of Allan's "$j_*$", and if $\varphi : \pi_1(X-B)\rightarrow G$ denotes the monodromy representation, then again we have that each component of $R$ is Galois over $B$ with Galois group
$$\varphi j_*\pi_1(\text{Spec }K)/\varphi i_*\pi_1(\text{Spec }K')$$
In particular the Galois group of each component of $R$ is a subgroup of the quotient the centralizer of an inertia group by that inertia group.
BEGIN ORIGINAL POST:
This is not an answer but it's too long to be a comment. One can obtain some restrictions on the structure of $R\rightarrow B$ as follows:
In terms of the Galois correspondence, if $\pi := \pi_1(B)$, $r\in R$ a point, and $F$ the fiber of $R/B$ containing $r\in R$, then $F$ is in bijection with $G/G_r$, and you have commuting actions of $\pi$ and $G$ on $F$. The image of $\pi$ in $Sym(F)$ thus lands in the centralizer of the $G$-action. Moreover, since the $G$-action commutes with the $\pi$-action, $G$ acts (transitively) on the $\pi$-orbits of $F$, and moreover if $G_{\pi\cdot r}$ denotes the subgroup of $G$ preserving the orbit $\pi\cdot r$, then $G_{\pi\cdot r}$ acts transitively on $\pi\cdot r$, and since it also commutes with the $\pi$-action, $G_r$ acts trivially on $\pi\cdot r$. Thus $G_r$ is normal inside $G_{\pi\cdot r}$, and the connected components of $R$ are all isomorphic, each component being Galois over $B$ with Galois group $G_{\pi\cdot r}/G_r$, which is naturally a subgroup of $N_G(G_r)/G_r$ where $N_G(G_r)$ is the normalizer of $G_r$ in $G$.
In particular e.g. if $G$ is simple and $G \ne G_r$ then $R$ cannot be connected, hence e.g. $B$ cannot be ample (by Remy's comments).
I would also be very interested if there's more one could say about this.
A: It is useful to reformulate the question in its natural differential topology setting, leaving unneeded geometric considerations aside. It is also natural to consider the analog of the problem in all dimensions.
So assume that we are given a closed, orientable, connected, smooth $n$-manifold $X$, and a closed, orientable, connected, smooth, codimension-$2$ submanifold $B \subset X$. We adopt the basic the notation used in the question. Let $G$ be a finite group. For every group epimorphism $$\varphi \colon \pi_1(X-B) \to G$$  there is a closed, orientable, connected, smooth $n$-manifold  $Y$ and a Galois (or ``regular'') ramified covering map $$f \colon Y \to X,$$
with deck transformation group $G$ that is branched at most over $B$.
Since $B$ is smooth, setting $R =f^{-1}(B) \subset Y$ we see that the restriction $$f|_R \colon R \to B$$ is an unramified  cover. The question seeks an explicit description of this covering map.
Among the issues that arise when trying to give such an explicit description are that $R$ need not be connected, that $f|_R:R \to B$ need not be a Galois covering, and that $B$ and $X-B$ cannot have the same base point.
The additional piece of data needed to clarify things is the normal bundle of the branch set and its boundary, a circle bundle over $B$. With this extra piece of information one can effectively answer the question.
We will from this point of view

*

*Characterize when  $R$ is connected;

*Characterize when $f$ is
actually ramified;

*Characterize when $R \to B$ is Galois;

*Show that on each component of $R$ the restriction of the branched covering is in fact always a Galois covering, with an explicit Galois group.

Let $N$ denote a small tubular neighborhood of $B$ in $X$, which has the structure of a $2$-disk bundle over $B$. Let $D$ denote a 2-disk fiber, with boundary  $C = D \cap \partial N$, a linking circle to $B$. Then $\partial N$ is a circle bundle over $B$, with typical fiber $C$.
This circle bundle is determined by its Euler class in $H^2(B;\mathbb{Z})$ and determines an exact sequence of homotopy groups (in which we suppress mention of the required base points)
$$
1 \to \pi_2(\partial N) \to \pi_2(B)  \to \pi_1(C) \to \pi_1(\partial N) \to \pi_1(B)\to 1.
$$
The image of $\pi_1(C)$ in $\pi_1(\partial N)$ lies in the center because of our orientability assumption. The only case in the dimension range $n\leq 4$ that $\pi_2(B)\neq 1$ is when $n=4$ and $B=S^2$. In all other low-dimensional cases it reduces to a central extension of $\pi_1(B)$ by $\mathbb{Z}$.
In general the assertion that $R$ is connected is the same as requiring that $f^{-1}(\partial N)$ be connected. And that translates into the homomorphism
$$
\varphi j_*:\pi_1(\partial N) \to G
$$
being surjective, where $j:\partial N \to X-B$ is the inclusion.
The condition that actual ramification occurs, translates into the condition that the homomorphism
$$
\varphi i_*:\pi_1(C) \to G
$$
is nontrivial, where $i:C \to X-B$ is the inclusion.
In general the image of $\varphi j_*:\pi_1(\partial N)\to G$ gives the group of deck transformations on any one of the path components of the pre-image of  the circle bundle $\partial N$ in $Y$.
It follows that for each component $R_k$ of the pre-image of the branch set, the projection $R_k\to B$ is a Galois covering with group of deck transformations isomorphic to
$$
\varphi j_*(\pi_1(\partial N))/  \varphi i_*(\pi_1(C)).
$$
The components of $R$ are permuted transitively by the action of $G$ on $Y$.  The full ramification covering $R\to B$ is the quotient map for the action of $G$ restricted to $R$. The covering $R\to B$ will be Galois if and only if the image  $\varphi i_*(\pi_1(C))$ is a normal subgroup of $G$, in which case the group of the covering is $G/ \varphi i_*(\pi_1(C))$.
Note, by the way, that since the image of $\pi_1(C)$ is central in $\pi_1(\partial N)$, it follows that if there is nontrivial ramification and $G$ has trivial center, then the pre-image of the branch set cannot be connected.
