Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File request failure #145

Closed
cqkisyouq opened this issue Nov 7, 2017 · 14 comments · Fixed by #158
Closed

File request failure #145

cqkisyouq opened this issue Nov 7, 2017 · 14 comments · Fixed by #158
Labels
question Initially seen a question could become a new feature or bug or closed ;)

Comments

@cqkisyouq
Copy link

At in DownstreamRouteFinderMiddleware
upstreamUrlPath = upstreamUrlPath.SetLastCharacterAs('/');

At the end of the url added '/',Make the url to access error.

@TomPallister
Copy link
Member

@cqkisyouq can you post your configuration.json file?

@cqkisyouq
Copy link
Author

"ReRoutes": [
{
"DownstreamPathTemplate": "api/{url}",
"DownstreamScheme": "http",
"DownstreamHost": "***",
"DownstreamPort": "8025",
"UpstreamPathTemplate": "/platform/{url}",
//"UpstreamHttpMethod": [ "Get" ],
//"ServiceName": "newapp",
//"LoadBalancer": "RoundRobin",
"QosOptions": {
"ExceptionsAllowedBeforeBreasking": 3,
"DurationOfBreak": 10,
"TimeoutValue": 5000
}
}

@cqkisyouq
Copy link
Author

cqkisyouq commented Nov 7, 2017

@TomPallister
like this.
/swagger/lib/backbone-min.js 200
/swagger/lib/backbone-min.js/ 404

@TomPallister
Copy link
Member

@cqkisyouq which version of Ocelot are you using? It should not append the / to the url for the downstream service. Unless I have introduced a bug :(

@cqkisyouq
Copy link
Author

@TomPallister version 2.0

Generate matching rules here:
Class ->UpstreamTemplatePatternCreator

Create(FileReRoute reRoute) upstreamTemplate = upstreamTemplate.SetLastCharacterAs('/');

@cqkisyouq
Copy link
Author

@TomPallister I want to access the file How to do?

@TomPallister
Copy link
Member

@cqkisyouq I'm not sure what you mean by access the file. Could you explain more?

I will write a failing test and see if we can understand the problem.

@cqkisyouq
Copy link
Author

@TomPallister
I want to visit the static files
like this url http://localhost/1.txt

After the ocelot processing into such a url http://localhost/1.txt/

Returns the status of 404

@TomPallister TomPallister added the question Initially seen a question could become a new feature or bug or closed ;) label Nov 10, 2017
@TomPallister
Copy link
Member

TomPallister commented Nov 18, 2017

@cqkisyouq please ignore previous comment.

@TomPallister
Copy link
Member

TomPallister commented Nov 18, 2017

@cqkisyouq

I have also noticed this part of your config. That should cause Ocelot to not work. I think you might have an older version of Ocelot.

"DownstreamPathTemplate": "api/{url}",

It needs to start with a forward slash.

Please use Install-Package Ocelot -Version 2.0.1 to get the latest!

@TomPallister
Copy link
Member

Ive got a branch here with some changes that I think fix your issue but I havent been able to get a failing test yet.

https://github.com/TomPallister/Ocelot/tree/feautre/fix-%23145

@TomPallister
Copy link
Member

OK I have a test for the issue! Pushed with my latest commit to that branch

@cqkisyouq
Copy link
Author

@TomPallister
That configuration is version 2.0.

static files:
It can be implemented on branches https://github.com/TomPallister/Ocelot/tree/feautre/fix-%23145
I see have cancel that code. // upstreamUrlPath = upstreamUrlPath.SetLastCharacterAs('/');

Thank you for your attention!

@TomPallister
Copy link
Member

@cqkisyouq please try

Install-Package Ocelot -Version 2.0.2

Hopefully will work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Initially seen a question could become a new feature or bug or closed ;)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants