cli icon indicating copy to clipboard operation
cli copied to clipboard

setup.backend.{name} in toml always create backend with overide_host set as the address

Open noguxun opened this issue 1 year ago • 8 comments

In toml, get below setup, notice that there is no setting field override_host .

[setup]
  [setup.backends]
    [setup.backends.example]
      address = "example.org"
      description = "example"
      port = 443

After running fastly compute publish We get a service with a backend that has "override host" set to example.org

Currently, there is no way to set up a backend with an empty "override host"

noguxun avatar Aug 05 '24 02:08 noguxun

Have you tried removing the setting in the management console after the fact? In my experience, this makes the backend stop functioning, so setting this value seems necessary.

cee-dub avatar Aug 05 '24 05:08 cee-dub

In many cases, getting override host set is needed for backend like example.org and and httpbin.org. but in some situations, I need this field to be blank so that my customized backend to receive the host header of the same value as the client's request.

noguxun avatar Aug 05 '24 05:08 noguxun

By the way, local_server has a functional override_host field (with or without the setting makes a difference).

[local_server]
  [local_server.backends]
    [local_server.backends.backend_b]
      url = "https://example.org/"
      override_host = "example.org"

noguxun avatar Aug 05 '24 05:08 noguxun

in some situations, I need this field to be blank so that my customized backend to receive the host header of the same value as the client's request

The platform doesn't allow this, unless your code registers a dynamic backend. The override host field is not the correct place to allow this feature.

cee-dub avatar Aug 05 '24 15:08 cee-dub

We've since come to a place where we are inconsistent in what we do by default for users. The UI will not add override host by default, but the cli will.

I thought it was the opposite, but I could be mistaken.

cee-dub avatar Aug 05 '24 18:08 cee-dub

The UI will not add override host by default, but the cli will.

Not only cli will (add override host by default), there is no way to let cli to not do it

noguxun avatar Aug 06 '24 13:08 noguxun

Indeed, the current data model for setup in fastly.toml doesn't offer any mechanism to set override_host, cert_host, and use_sni even though the local_server block does. This is quite unfortunate as the behavior should be consistent. I'll do some investigating today to see if this can be added relatively quickly, without waiting for the fastly.toml redesign that we've been discussing.

kpfleming avatar Aug 13 '24 12:08 kpfleming

Well, the fix won't be quick as it will require extensive work in the test suite for the deploy command, but it will get done anyway. Look for some progress in a week or two.

kpfleming avatar Aug 14 '24 21:08 kpfleming