Removing hash from URL of Angular app is not working within docker container

Viewed 61

I am facing one issue after removing hash from URL of one of my angular app which running through docker. I am explaining my code below.

src/app/app-routing.module.ts::

imports: [
    ...
    RouterModule.forRoot(routes)  // removed { useHash: true }
]

So after removing { useHash: true } now no hash is coming with URL but issue is when I am refreshing the page its giving 404 error. My angular application is running inside docker container and I am using ubuntu:20.04 server for docker like below.

Dockerfile::

FROM ubuntu:20.04

LABEL maintainer="a@gmail.com"
LABEL build_date="2021-09-17"

RUN apt-get update

# SET TZ
RUN apt-get install -y tzdata
RUN echo 'Asia/Kolkata' > /etc/timezone
RUN dpkg-reconfigure --frontend noninteractive tzdata
...................................
...................................

Here I need after removing the # also when user will refresh the page the same page will appear again. Please help me to resolve this issue.

0 Answers
Related