You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apisix.apache.org by YuanSheng Wang <me...@apache.org> on 2020/06/22 08:42:43 UTC

[discuss] Add a global option to decide whether to remove the "/" at the end of the URI.

Hi:

URI 1: http://xxxx:port/foo/bar/
URI 2: http://xxxx:port/foo/bar

The difference between these two URIs is whether they include "/" at the
end.
For API providers, they often represent a URI resource.

How about adding a global option: before starting to match a route, delete
the "/" character at the end of the URI.

For example, URI 1 will be modified to http://xxxx:port/foo/bar after
deleting.

In other words, when this option is turned on, URI 1 and URI 2 are the same.

-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix

Re: [discuss] Add a global option to decide whether to remove the "/" at the end of the URI.

Posted by YuanSheng Wang <me...@apache.org>.
> my idea is there should be a field that is configable in config.yaml that
> determines whether or not to remove the last "/"

that is the way I would like. ^_^


On Mon, Jun 22, 2020 at 6:47 PM Li Ling(Lien) <li...@apache.org> wrote:

> This has happened to me before,
>  and I solved it by adding a severless lua function.
> my idea is there should be a field that is configable in config.yaml that
> determines whether or not to remove the last "/"
>
> YuanSheng Wang <me...@apache.org> 于2020年6月22日周一 下午4:42写道:
>
> > Hi:
> >
> > URI 1: http://xxxx:port/foo/bar/
> > URI 2: http://xxxx:port/foo/bar
> >
> > The difference between these two URIs is whether they include "/" at the
> > end.
> > For API providers, they often represent a URI resource.
> >
> > How about adding a global option: before starting to match a route,
> delete
> > the "/" character at the end of the URI.
> >
> > For example, URI 1 will be modified to http://xxxx:port/foo/bar after
> > deleting.
> >
> > In other words, when this option is turned on, URI 1 and URI 2 are the
> > same.
> >
> > --
> >
> > *MembPhis*
> > My GitHub: https://github.com/membphis
> > Apache APISIX: https://github.com/apache/incubator-apisix
> >
>


-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/incubator-apisix

Re: [discuss] Add a global option to decide whether to remove the "/" at the end of the URI.

Posted by "Li Ling(Lien)" <li...@apache.org>.
This has happened to me before,
 and I solved it by adding a severless lua function.
my idea is there should be a field that is configable in config.yaml that
determines whether or not to remove the last "/"

YuanSheng Wang <me...@apache.org> 于2020年6月22日周一 下午4:42写道:

> Hi:
>
> URI 1: http://xxxx:port/foo/bar/
> URI 2: http://xxxx:port/foo/bar
>
> The difference between these two URIs is whether they include "/" at the
> end.
> For API providers, they often represent a URI resource.
>
> How about adding a global option: before starting to match a route, delete
> the "/" character at the end of the URI.
>
> For example, URI 1 will be modified to http://xxxx:port/foo/bar after
> deleting.
>
> In other words, when this option is turned on, URI 1 and URI 2 are the
> same.
>
> --
>
> *MembPhis*
> My GitHub: https://github.com/membphis
> Apache APISIX: https://github.com/apache/incubator-apisix
>