A locally running Azure Functions app is available from http://localhost:7071. The server side rendered react app is exposed at http://localhost:7070. Both the functions app and the react app are reverse proxied from a simple nginx container locally hosted (http://localhost:7072). For the sake of completeness, here's the nginx conf:
http {
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mywebapp-localdev;
location /api {
proxy_pass http://10.0.75.1:7071;
}
location / {
proxy_pass http://10.0.75.1:7070;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
Here's the issue: if the address http://10.0.75.1:7071/api/hello-world is hit directly from the browser, the function behaves as expected. However if the function is called through the reverse proxy (http://localhost:7072/api/hello-world) then it times out. A couple tests from within the nginx container also indicate that the port 7071 on 10.0.75.1 is unreachable.
The question is: how is it possible to access a locally running Azure Function (using func host start
) from a Docker container also running locally?