Issue with 404 not found page

Hi
I have some problem.
I deployed site with the github repo: GitHub - mb83pl/geoip and when I’m trying to get an url (Geoip) I get an 404 not found page.
Routing is fine, on localhost it works good.
What could be causing this problem?

Hey @mb83pl

The issue here is your app in an SPA and as such requires a redirect to work properly (unless it is pre-rendered.) Check out the Angular on Netlify documentation, especially the redirects section which provides the solution.

Thanks for your advice, I added a netlify.toml to my repo and still I have that same problem.

I see you’ve added it to the root of the repository (which is where it is meant to reside.) Are you still seeing the same issue?

It works now, I put this file in the main folder of repo.
But now I have the problem with API provider - mixed content is blocked :slightly_frowning_face:
https://developer.mozilla.org/pl/docs/Web/Security/Mixed_content
I have to change the provider, anyway thanks for advice :slight_smile:

I’m not seeing a mixed content blocked. I’m seeing a “403 Forbidden” as you don’t have a key to access the endpoint (you need to pay for that!)

You can try setting up a proxy in the netlify.toml (before the redirect you have currently)

[[redirects]]
  from = "/ipapi/*"
  to = "http://ip-api.com/json/:splat"
  status = 200

then in the ip-data.service.ts file change

getDataByIP = (ip: string): Observable<IP> => {
  return this.http.get<IP>(`http://ip-api.com/json/${ip}`)
}

to

getDataByIP = (ip: string): Observable<IP> => {
  return this.http.get<IP>(`/ipapi/${ip}`)
}

Related documentation: Rewrites and proxies | Netlify Docs

Did you try creating a redirect as I outline previously?

Another thing to note is the access token is embedded in your code and visible in the front end too. If this is a key that should remain secret, remove it from the codebase to an environment variable and use a function to keep it a secret.