Can traefik-v2.4 use return as nginx does?

Hi, friends from the community

I have a puzzle, I searched through the official documents and did not find anything related to the function of Nginx Return, similar to such function requirements

location ~* (/api|/statics|/manage/driverPosition) {
    return 301 https://$host$request_uri;
    }
 location  ~* ^/driv/index.html {
        charset utf-8;
        default_type        text/html;
        return 200 "this is test";
    }
  • Hope the community partners can give help, in this grateful

You could use the ping@internal service. Otherwise, no it does not.

You may have to use this option to setup your own routing.
https://doc.traefik.io/traefik/operations/ping/#manualrouting

It will return status code 200 with a body of OK

Hi @cakiwi
What I want is to access the path of a domain name and return a sentence directly to the client. I don't need to access the Service at the back end. I want to process the return directly on Traefik.

If you want a body other than OK you'll have to run a service with traefik.

OK, thank you, it seems that we can only do so, thanks again!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.