Hi Jessica, My application is a static web app (React.js), packaged to a docker image (nginx) [1]. Then I have an Openshift/k8s deployment (+Service) originating from that image. After that I create a Route that exposes the Service to the outside world.
So what you are proposing is adding the default route (pointing to /index.html) to my nginx configuration. Am I correct? Honestly, I was expecting HAProxy (i.e. OCP Route) to handle all the routing for me. [1] https://raw.githubusercontent.com/maslick/barkoder-ui/react/docker/Dockerfile Regards, Pavel Maslov, MS On Mon, May 13, 2019 at 2:53 PM Jessica Forrester <jforr...@redhat.com> wrote: > Your backend file server that is actually serving up your JS files needs > to understand what paths are considered your "frontend" and always serve > your index.html when it gets requests against any of those paths. This is > what the OpenShift console itself does. In the 3.x openshift console it was > in the http handlers logic in our go binary. At one point I also prototyped > this just using changes to an httpd.conf for simple apache file servers. > > On Mon, May 13, 2019 at 7:22 AM Pavel Maslov <pavel.masl...@gmail.com> > wrote: > >> Anyone? I bet it's a common use-case (Angular, React.js frontend apps), >> can't be that nobody has had this issue... >> >> >> Regards, >> Pavel Maslov, MS >> >> >> On Thu, May 9, 2019 at 10:50 AM Pavel Maslov <pavel.masl...@gmail.com> >> wrote: >> >>> Hi all, >>> >>> >>> I have a React.js single-page app deployed to Openshift that uses its >>> own router (e.g. /home, /about, /photos, etc.). Everything works fine (user >>> navigating around my app) until the user refreshes the page. This in turn >>> fires a GET request to the server, which it of course cannot resolve (404). >>> >>> One solution I am using in "raw" k8s is for each endpoint I create a new >>> path (i.e. /home, /about, /photos) inside an Ingress object, which is >>> redirected to the web app Service [1]. >>> >>> Is there any solution for Openshift's Router? Maybe, a custom Router >>> annotation that will redirect all requests to "/"? >>> >>> Thanks a lot in advance. >>> >>> [1] >>> https://github.com/maslick/barkoder/blob/master/deployment/k8s-barkoder-ingress.yaml >>> >>> Regards, >>> Pavel Maslov, MS >>> >> _______________________________________________ >> users mailing list >> users@lists.openshift.redhat.com >> http://lists.openshift.redhat.com/openshiftmm/listinfo/users >> >
_______________________________________________ users mailing list users@lists.openshift.redhat.com http://lists.openshift.redhat.com/openshiftmm/listinfo/users