You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/04/12 09:32:17 UTC
[GitHub] [apisix] kekoke commented on issue #6648: help request: Use Nginx as proxy service, return 404 not found
kekoke commented on issue #6648:
URL: https://github.com/apache/apisix/issues/6648#issuecomment-1096446287
> Hi @tzssangglass, sorry for I have one more qunestion. I note that When I exclude --resolve parmeter in command, I will got the 404. As I know Nginx will forward to http request of `apigw-dev.com` to `127.0.0.1:9080(0.0.0.0:9080)` in the Server, Why are we adding `--resolve 'apigw-dev.com:80:127.0.0.1'` into CURL request?
Hi tzssangglass, I foud a solution to replace '--resolve' command,
I add `services` in request header to replace `Host` as below
```
curl --location --request GET 'http://apigw-dev.com/api/account/info' \
--header 'services: uat-sanctions-api.com'
```
and update `nginx` config `proxy_set_header Host $host` to `proxy_set_header Host $http_services;`
```
server {
listen 80;
server_name apigw-dev.com;
location / {
proxy_pass http://0.0.0.0:9080; # APISIX admin API
proxy_set_header Host $http_services; # pass Host header to upstream, it's important
root /home/application;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
```
Just sharing, thanks again!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org