Using local SSL for netlify dev
results in the edge function not receiving the correct scheme, hostname, or port
#5945
Labels
type: bug
code to address defects in shipped code
Describe the bug
When not using SSL locally with
netlify dev
, edge functions will see the hostname requested by the HTTP client (curl
in these examples).However, when using SSL locally with
netlify dev
, edge functions will see the hostname aslocalhost
and the port number used will also be changed to the randomly assigned port that anetlify dev
HTTP server is listening on (which is not the port the client makes the request to).This should not occur. For local development, the edge function should correctly receive the URL requested by the client even when SSL is being used.
Steps to reproduce
Reproduction steps:
certbot
utility to do so.)netlify dev
to use that certificate for SSL:You can define a local SSL configuration with
netlify dev
using the following syntax innetlify.toml
:/etc/host
file like so (usingfoo.example.com
here):netlify dev
curl https://foo.example.com:8888/
(note: the URL is using HTTPS)The protocol, hostname, and port - all three - have been changed from the point of view of the edge function.
If SSL is not used with
netlify dev
this does not occur. Without local SSL, the edge functions gets the correct request information from the client.Note, you will need to use a real domain name you control to provision the SSL. The domain used in testing was not
foo.example.com
and that is only a placeholder for the actual domain used.Configuration
The
netlify.toml
sections that are applicable:The edge function code
request-logging.ts
:Environment
The text was updated successfully, but these errors were encountered: