I have a backend configured that I am using in production. I would like to use the same backend in my local development environment.
I have configured the backend as follows:
[local_server]
[local_server.backends]
[local_server.backends.<my backend>]
url = "<my backend's api url>"
And when I start the local service with fastly compute serve, it seems to connect to the backend:
✓ Running local server
INFO: Listening on http://127.0.0.1:7676
INFO: Command output:
--------------------------------------------------------------------------------
2023-09-24T18:53:32.945566Z INFO checking if backend '<my backend>' is up
2023-09-24T18:53:33.250933Z INFO backend '<my backend>' is up
2023-09-24T18:53:33.251065Z INFO Listening on http://127.0.0.1:7676
The actual request my local service makes looks fine, except that the request body is omitted. I’m wondering if I need to do something special with the local server to configure TLS in order to get the request body to send?
Yes, what you had defined would have caused an error.
The url field is a little misleading because it’s supposed to be a scheme/hostname combination but not the ‘path’ segment, as the request’s path is appended to the backend url.
Something for us to clarify in our documentation:
UPDATE:
I stand corrected! I just re-read our documentation and noticed it does say a path prefix is allowed, so yes please @crajcan if you could send support@fastly.com your code and a link to this forum thread that would be greatly appreciated.
I’ve successfully tested the use of a path-prefix (see screenshot below), so I would recommend emailing support@fastly.com as they’ll be able to take a look at your source code and check your configuration to see if there’s anything mis-configured that would cause this to not work.