Comments (14)
Hi,
thanks for your report.
Please can you provide your ocelot.json
configuration?
Thanks.
from mmlib.swaggerforocelot.
this is my
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "industryapi",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/I/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
},
{
"DownstreamPathTemplate": "/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "logisticapi",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/L/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ],
"SwaggerKey": "Logistic"
},
{
"DownstreamPathTemplate": "/api/OrderAPI/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "orderapi",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/O/{everything}",
"UpstreamHttpMethod": [ "POST", "PUT", "GET" ]
}
//,
//{
// "DownstreamPathTemplate": "/swagger/index.html",
// "DownstreamScheme": "http",
// "DownstreamHostAndPorts": [
// {
// "Host": "industryapi",
// "Port": 80
// }
// ],
// "UpstreamPathTemplate": "/api/IndustryAPI/swagger",
// "UpstreamHttpMethod": [ "POST", "PUT", "GET" ]
//}
],
"SwaggerEndPoints": [
{
"Key": "Industry",
"Config": [
{
"Name": "Industry API",
"Version": "v1",
"Url": "http://localhost:51010/swagger/v1/swagger.json"
}
]
},
{
"Key": "Logistic",
"Config": [
{
"Name": "Logistic API",
"Version": "v1",
"Url": "http://localhost:51020/swagger/v1/swagger.json"
}
]
}
],
"GlobalConfiguration": {
"RequestIdKey": "OcRequestId",
"AdministrationPath": "/administration"
}
}
from mmlib.swaggerforocelot.
Hi,
I apology, I cannot reproduce this behaviour.
- Are you sure that swagger docs for
Industry
is accessible fromhttp://localhost:51010/swagger/v1/swagger.json
? - Added you
services.AddSwaggerForOcelot(Configuration);
inConfigureServices
method inStartup
class? - Added you
app.UseSwaggerForOcelotUI(Configuration);
inConfigure
method inStartup
class?
from mmlib.swaggerforocelot.
I used all of the thing what you say, but still i can't fix that
please help me on it !
from mmlib.swaggerforocelot.
please, you can provide a sample where this behavior is isolated
from mmlib.swaggerforocelot.
this is our project
we are using microservice with docker
and all of them separate projects with solution. normally swagger work with separately.
we had api gate way for all service.
i want to access all the service with one baseURL with api gate way in this case all of them are working good, the problem is swagger didn't work on api gate way i want to access all service swagger from api gate way.
from mmlib.swaggerforocelot.
I understand, this is main reason why this project was created. For microservices with one base api gateway base url. Where we want access to documentation for all downstream services in one place.
A typical problem when you get 500 Internal Server Error
is that ApiGateway doesn't have access to SwaggerEndpoint.Url
in your case http://localhost:51010/swagger/v1/swagger.json
.
Are you sure your ApiGateway has access to this address? Can't be the problem in Docker configurations?
Doesn't it work when you use the following configuration?
"SwaggerEndPoints": [
{
"Key": "Industry",
"Config": [
{
"Name": "Industry API",
"Version": "v1",
"Url": "http://industryapi:80/swagger/v1/swagger.json"
}
]
},
{
"Key": "Logistic",
"Config": [
{
"Name": "Logistic API",
"Version": "v1",
"Url": "http://logisticapi:80/swagger/v1/swagger.json"
}
]
}
]
By the way, in the ReRout configurations for the industryapi
you are missing SwaggerKey
, but this does not cause this error.
from mmlib.swaggerforocelot.
http://localhost:51010/swagger/v1/swagger.json this one is working fine,
but its always shows same error.
this is my Docker Cofiguration file
services:
apigw:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80
ports:
- "51000:80"
volumes:
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
industryapi:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80
- ConnectionString=${ESHOP_AZURE_INDUSTRY_DB:-Server=sqlserver ; Database=IndustryDb; User Id=sa;Password=password}
ports:
- "51010:80"
volumes:
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
logisticapi:
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80
- ConnectionString=${ESHOP_AZURE_INDUSTRY_DB:-Server=sqlserver ; Database=LogisticDb; User Id=sa;Password=password}
ports:
- "51020:80"
volumes:
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
- ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
from mmlib.swaggerforocelot.
This is my startup file
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerForOcelot(Configuration);
services.AddOcelot(Configuration);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public async void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseSwaggerForOcelotUI(Configuration, opt =>
{
opt.EndPointBasePath = "/swagger/docs";
});
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
await app.UseOcelot();
}
from mmlib.swaggerforocelot.
I can provide my pc with teamviewer, can you allocate you time for me to solve this problem,
if you ok with it
i will waiting for you !
from mmlib.swaggerforocelot.
What do you have in PATH_BASE
?
from mmlib.swaggerforocelot.
Now its working
but i got another issue,
api gate way downstream url missing the "/"
Like this
http://localhost:51000/api/I/industry - this is what i want !
this is what it got.
http://localhost:51000apiI/industry
from mmlib.swaggerforocelot.
- What have you changed when it works now?
- What do you have in
PATH_BASE
setting? (app.UsePathBase(pathBase);
)
from mmlib.swaggerforocelot.
i didn't know about that,
two guys work on that , api gate way created by that guy, i am new for This field ,
i forgot to change the port number in swagger key
"Name": "Industry API",
"Version": "v1",
"Url": "http://industryapi:80/swagger/v1/swagger.json"
i here.
from mmlib.swaggerforocelot.
Related Issues (20)
- SSL error in Self-Signed certification HOT 4
- Getting 404 when running with KubernetesServiceDiscoveryProvider HOT 8
- Swagger for YARP HOT 4
- Documentation -> o.GenerateDocsForGatewayItSelf HOT 1
- Getting 404 when running with KubernetesServiceDiscoveryProvider HOT 1
- Wrong Swagger url generated when using KubernetesServiceDiscoveryProvider HOT 1
- Failed to load API definition issue HOT 17
- OpenApi fails on reading file HOT 2
- Virtual Directory configuration IIS doesn't work UpstreamPathTemplate 404 not found HOT 1
- Request: Api Search across all swagger docs HOT 2
- Added ApiController to Ocelot Gateway, but gets 404 when requesting it HOT 4
- Ocelot Gateway controllers return enum values as integer instead of string.
- A bug when using .NET8-Ocelot[20.*]
- Status code 500 using 8.1.0 with multiple routes HOT 1
- Failed to load API definition - value cannot be null HOT 1
- getting error when use service discovery HOT 7
- Cant send code_challenge when using SwaggerForOcelot
- Error with gateway hosted under https://example.com/internal-gateway instead of https://example.com
- Using the Consul service discovery, it was found that the request path in the gateway swagger document does not have the "KeyToPath" property attached
- Can you still customize your base URL in newer versions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mmlib.swaggerforocelot.