I have used private endpoint to both of vm and app service. In the VM console, it works when using the domain, but it failed when using private IP.
$ curl https://myAppService..azurewebsites.net
{"result":"Hello World","code":200,"success":true}
$ curl http://10.0.5.5
....
<h1>404 Web Site not found.</h1>
<p>You may be seeing this error due to one of the reasons listed below :</p>
....
I can understand it so far. However, I set apisix routing config like below, and get 404 error as well.
{
"uri": "/test/*",
"name": "test",
"methods": [
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE",
"PURGE"
],
"plugins": {
"cors": {
"allow_credential": false,
"allow_headers": "*",
"allow_methods": "*",
"allow_origins": "*",
"disable": false,
"expose_headers": "*",
"max_age": 5
},
"proxy-rewrite": {
"uri": "/"
}
},
"upstream": {
"nodes": [ <--------- Here
{
"host": "myAppService.azurewebsites.net",
"port": 443,
"weight": 1
}
],
"retries": 3,
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "https",
"pass_host": "pass",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
},
"status": 1
}
After I checked access.log
, I figure out that the gateway resolves the host, and route the request with the ip (10.0.5.5).
[14/Dec/2022:11:00:15 +0000] 20.212.162.118 "GET /test/123 HTTP/1.1" 404 2667 0.012 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.46" 10.0.5.5:443 404 0.012
Is there any suggestion ?
I want to route normally...
I finally found the answer after I figured out the issue is related with Nginx...
Due to Application Request Routing Affinity(ARR), it is required that setting the Hostname to "Use the domain name or IP from Node list".
As a result, Apisix won't resolve the hostname, e.g *.auzrewebsits.net
to 10.0.x.x
, and the ARR works.
Hooray!!