Call back: 404 error page not found

Hi all I am new to the field of reverse proxy & load balancer I follow the installation guide of the documentation
my config.toml:

[accesslog]
[api]
    insecure = true
    dashboard = true
    debug = true
[log]
    level = "INFO"

[entryPoints]
    [entryPoints.web]
        address = ":80"

    [entryPoints.nsia]
        address = "127.0.0.2:5000"
    [entryPoints.nsia.http]
    [entryPoints.nsia.http.redirections]
    [entryPoints.nsia.http.redirections.entryPoint]
        to = "websecure"
        scheme = "https"
        permanent = true
        priority = 10

    [entryPoints.websecure]
    address = ":443"

[providers.file]
    directory = "services/"
    watch = true

and this is my
traefik.toml file (is in service folder)

[http]
    [http.routers]
        [http.routers.traefik_route]
            entryPoints = ["nsia"]
            rule = "Host(`localhost`) && Path(`/api/*`)"
            middlewares = ["api-forwarding"]
            service = "traefik"

    [http.middlewares]
        [http.middlewares.api-forwarding.headers.customRequestHeaders]
            X-Forwarded-Host = "api.publicapis.org"
            X-Forwarded-Proto = "https"
            X-Forwarded-Port = "443"
            X-Forwarded-Uri = "/entries"


    [http.services]
        [http.services.traefik]
            [http.services.traefik.loadBalancer]
                [[http.services.traefik.loadBalancer.servers]]
                    url = "https://api.publicapis.org/entries"

But when I call "127.0.0.2:5000"
I get a 404 page not find error
Yet if I replace "https://api.publicapis.org/entries" by local adresse for exemple: "127.0.0.1:8001" server, it goes
Can anyone help me? It's very urgent!

Did you create 127.0.0.2 as IP on your host?

You have a redirect on your port 5000, so I would assume no requests on port 5000 will ever be forwarded.

Note that the forward headers are automatically created by Traefik.

Yes to do the test, I created an address: 127.0.0.2:5000, which I tested by pinging; The address successfully answers. My question is do I have to have a particular configuration.? The context of my project is as follows: Our team works in a local network (intranet) and we have to communicate with external partners. we cannot give direct access to our servers, So we want to make rediirection in order to communicate with the web services of the parties on the Internet without going through VPN.

i need help please

Can you provide more details? What is the URL you want to call and what is the URL Traefik should forward the request to? (What do they look like)

no problem, The address that Traefik must expose is: 127.10.126.123. The API I need to consume is: https://api.publicapis.org/entries (an example). So here, when I am on 127.10.126.123, it must automatically redirect me to https://api.publicapis.org/entries. and give me a result. The problem is that currently from I receive 404 page not found. whereas if I type directly www.edan.ci/api in my browser I get feedback.

to explain simply. Suppose I have a web service, I want to consume an API through Traefik. My server is: 17.10.116.111 and the API is https://api.publicapis.org/entries. on the web

If you locally call an IP (not a domain) with http, then you must set the router rule to it (Host(`1.2.3.4`)), so Traefik can match the incoming request and forward it to the according service.

Not sure you need this, it will redirect port 5000 to 443.

When you want to forward requests addressed to 127.0.0.2:5000 to the external url, then you need a router with rule = "Host(`127.0.0.2`)" to match the request.

hello i come back because i havn't solution:
but this my new configuration:
config.toml:
[accesslog]
[api]
insecure = true
dashboard = true
debug = true
[log]
level = "INFO"

[entryPoints]
[entryPoints.web]
address = ":80"

[entryPoints.nsia]
    address = "127.0.0.2:5000"
[entryPoints.nsia.http]
[entryPoints.nsia.http.redirections]
[entryPoints.nsia.http.redirections.entryPoint]
    to = "websecure"
    scheme = "https"
    permanent = true
    priority = 10

[entryPoints.websecure]
address = ":443"

[providers.file]
directory = "services/"
watch = true

traefik.toml (is in server folde: directory = "services/")
[http]
[http.routers]
[http.routers.traefik_route]
entryPoints = ["nsia"]
rule = "Host(127.0.0.2:5000) && Path(/api/*)"
middlewares = ["api-forwarding"]
service = "traefik"

[http.middlewares]
    [http.middlewares.api-forwarding.headers.customRequestHeaders]
        X-Forwarded-Host = "api.publicapis.org"
        X-Forwarded-Proto = "https"
        X-Forwarded-Port = "443"
        X-Forwarded-Uri = "/entries"


[http.services]
    [http.services.traefik]
        [http.services.traefik.loadBalancer]
            [[http.services.traefik.loadBalancer.servers]]
                url = "https://api.publicapis.org/entries"
            [[http.services.traefik.loadBalancer.servers]]
                url = "https://api.publicapis.org/entries"

NB: i'm on my local labtop

Format your code with 3 backticks in front and after, or select the code and press </> .

config.toml:

[accesslog]
[api]
insecure = true
dashboard = true
debug = true
[log]
level = "INFO"

[entryPoints]
[entryPoints.web]
address = ":80"

[entryPoints.nsia]
    address = "127.0.0.2:5000"
[entryPoints.nsia.http]
[entryPoints.nsia.http.redirections]
[entryPoints.nsia.http.redirections.entryPoint]
    to = "websecure"
    scheme = "https"
    permanent = true
    priority = 10

[entryPoints.websecure]
address = ":443"

[providers.file]
directory = "services/"
watch = true

traefik.toml (is in server folde: directory = "services/")
[http]
[http.routers]
[http.routers.traefik_route]
entryPoints = ["nsia"]
rule = "Host(127.0.0.2:5000) && Path(/api/*)"
middlewares = ["api-forwarding"]
service = "traefik"

[http.middlewares]
    [http.middlewares.api-forwarding.headers.customRequestHeaders]
        X-Forwarded-Host = "api.publicapis.org"
        X-Forwarded-Proto = "https"
        X-Forwarded-Port = "443"
        X-Forwarded-Uri = "/entries"


[http.services]
    [http.services.traefik]
        [http.services.traefik.loadBalancer]
            [[http.services.traefik.loadBalancer.servers]]
                url = "https://api.publicapis.org/entries"
            [[http.services.traefik.loadBalancer.servers]]
                url = "https://api.publicapis.org/entries"

Path() does exact matching, I don’t think you have a route called /api/*. Use PathPrefix(`/api/`) instead.

Traefik documentation is your friend. It is a lot, as Traefik has a lot of configuration options, but usually well written and with examples.

hello ok thank you,
i come back to you