emissary-ingress / emissary

open source Kubernetes-native API gateway for microservices built on the Envoy Proxy
https://www.getambassador.io
Apache License 2.0
4.37k stars 685 forks source link

host regex error #3147

Closed clguo-tw closed 2 years ago

clguo-tw commented 3 years ago

Hi, I try use host_regex in my mapping, i got error as below

level=warning msg="Could not parse host '^api-dev(\\.internal)?\\.example\\.com$' in Mapping 'example-api': using empty host" func=github.com/datawire/apro/cmd/amb-sidecar/devportal/server.NewMappingFromJSON file="github.com/datawire/apro/cmd/amb-sidecar/devportal/server/mappings.go:95

jasonstitt commented 3 years ago

I also can't get any host_regex to work. If I use a host that is a regex, I get the above. If it's a plain string, there's no error in the Ambassador logs, but the mapping doesn't work. Almost as if host_regex is being ignored.

sambonbonne commented 3 years ago

Same here, I tried different host with host_regex: true, it seems the host check is ignored.

Maybe I missed it but I don't find a clear documentation about host and host_regex.

EDIT: found the doc but it does not really help, still seem to have the bug after different tries. The doc shows prefix: /backend and tells all / requests will be forwarded, does this mean the prefix is ignored when using a host?

cindymullins-dw commented 2 years ago

With version 2.x there are some changes to this. Please see this docs page for details (noted below). Please let us know if issues persist on 2.x.

A getambassador.io/v3alpha1 Mapping will honor host and host_regex as a transition aid, but host and host_regex are deprecated in favor of hostname. A Mapping that specifies host_regex: true will be associated with all Hosts. This is generally far less desirable than using hostname with a DNS glob.