Closed developers-youcong closed 4 years ago
What does this have to do with spring cloud?
Have a relationship. I deployed the gateway, which is the entry point for all projects. However, I used Nginx as a reverse proxy for this entry, but I could not access it as a reverse proxy
I still don't understand the relationship to gateway, what, if any, error there is.
There were no errors such as 500, but my gateway project was configured to Nginx and could not be accessed through Nginx, and Nginx could access a direct 404. If you want nginx to be accessible, it has to be in location /{}, not location /blog{}. My initial guess was that nginx was in conflict with the Spring Cloud-Gateway
At this point all you've shown is nginx configuration I can't help with. Please show your gateway configuration, how you make requests to the gateway and the behavior you are seeing from the gateway. No nginx
My GateWay Core Config File Detail(application-dev.yml):
cloud:
gateway:
discovery:
locator:
lowerCaseServiceId: true
enabled: true
routes:
- id: blog-auth
uri: lb://blog-auth
predicates:
- Path=/auth/**
filters:
- ValidateCodeFilter
- StripPrefix=1
- id: blog-admin
uri: lb://blog-admin
predicates:
- Path=/system/**
filters:
- name: BlackListUrlFilter
args:
blacklistUrl:
- /user/info/*
- StripPrefix=1
bootstrap.yml:
# Tomcat
server:
tomcat:
uri-encoding: UTF-8
min-spare-threads: 500
max-threads: 2500
max-connections: 5000
accept-count: 1000
max-http-header-size: 1048576
protocol: org.apache.coyote.http11.Http11AprProtocol
port: 8080
# Spring
spring:
application:
name: blog-gateway
profiles:
active: dev
main:
allow-bean-definition-overriding: true
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
config:
server-addr: 127.0.0.1:8848
file-extension: yml
shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
eager: true
transport:
dashboard: 127.0.0.1:8718
datasource:
ds1:
nacos:
server-addr: 127.0.0.1:8848
dataId: sentinel-eqics-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: flow
These are the two key profiles for my SpringCloud Gateway。
How do you make requests? What is the error or behavior you are seeing?
My configuration in Nginx is as follows:
`
location /{
The proxy http://127.0.0.1:8080;
}
`
Result: Normal proxy, can access to the correct URL.
But if I configure it this way:
`
location /blog{
The proxy http://127.0.0.1:8080;
}
`
Result: Agent failed, access 404
So I wonder if the gateway conflicts with Nginx
I'm sorry but nginx configuration isn't helpful.
The error I saw was that it could not be accessed through the nginx reverse proxy.
If it is a separate gateway, not through Nginx, then normal.
There is no specific error message
I simply want to proxy the gateway project under Nginx and specify the access address.
Such as visiting http://127.0.0.1:8686/blog asked gateway
In the absence of anything that suggests there's a bug in gateway I'm going to close this.
Describe the bug SpringCloudVersion is Hoxton.SR4
Sample Why can't you configure access on Nginx? A visit like the one above will report 404 directly.
If it is configured in this way, it can be accessed normally. As shown in the figure below:
My guess is there a conflict between SpringCloudGateWay and Nginx routing distribution?