Open Nditah opened 4 years ago
I am also having this concern. @Nditah did you find a way around this?
Me too. I got a problem with this.
I found that the gateway always listens on the server IP address request but not the localhost request. I think that we need to make it support localhost requests.
I found the solution, config the hostname
to 0.0.0.0
"http": {
"hostname": "0.0.0.0",
"port": 1234
},
I have formatted gateway.config.yml through onlineyamltools.com after my changes and it has started working.
NOW IT LOOK LIKE:
http:
port: 8080
admin:
port: 9876
host: localhost
apiEndpoints:
api:
host: localhost
paths: /ip
reqres:
host: localhost
paths: /api/users
serviceEndpoints:
httpbin:
url: https://httpbin.org
reqresserv:
url: https://reqres.in
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines:
default:
apiEndpoints:
- api
policies:
- proxy:
- action:
serviceEndpoint: httpbin
changeOrigin: true
reqrespipeline:
apiEndpoints:
- reqres
policies:
- proxy:
- action:
serviceEndpoint: reqresserv
changeOrigin: true
how reverse proxy in nginx for express gateway, my app not found always
@Nditah would you check your nginx config file? I can see two location /
and I don't know how come those both run with different 5000 and 5010 port? How may it differentiate?
BTW, It is possible what you are trying to.
Entering Issues
Express-Gateway is unable to bind to localhost or 127.0.0.1
The Reverse proxy works as expected for any other service apart from the gateway.
Accessing the gateway via the nginx returns a Cannot GET /api/erp
However, access the gateway locally on the machine works well as expected.
Binding host: localhost for the http in gateway.config.yml has no effect whatsoever.
How can I resolve this.
Gateway.config.yml
The Reverse proxy with Nginx