Comments (3)
Please check the pull request. Usage:
services.AddProxy(configureOptions: options =>
{
options.RewriteResponseLocationHeader = true;
});
I still haven't understood your Unit Test yet so I will need your help on this. I have tested it with https://httpstat.us/301.
from proxykit.
It appears the upstream host is not aware of or using the x-forwarded headers. If it uses those headers, it would generate the correct absolute URL in the location header. Is this not the case?
from proxykit.
@datvm I've added a test #79 that ensures the location header is correct. If your upstream host is not generating the correct URLs then it is not configured to use X-Forwarded-*
headers correctly. Please see the relevant section in the documentation.
Finally, if you really want or need to to do location header rewrites do it in your proxy code. Something like...
app.RunProxy(async context =>
{
var response = await context
.ForwardTo("http://localhost:" + port + "/")
.AddXForwardedHeaders()
.Send();
if (response.Headers.Location != null)
{
response.Headers.Location = <rewrite here>;
}
return response;
}));
... which could be wrapped in an extension method.
As such, I won't be accepting your proposed change.
from proxykit.
Related Issues (20)
- 502 Bad Gateway - Azure HOT 8
- Reverse proxy failing for upstream with invalid certificate HOT 1
- 301 response from upstream service causes InvalidOperationException HOT 1
- Is this project dead? HOT 3
- Can I simulate post to log in a website and then reverse it? HOT 1
- Drop TestServer HOT 2
- Run on dedicated endpoint HOT 2
- ProxyKit, YARP and planned obsolescence. HOT 2
- Incorrect forwarding of multiple cookies HOT 4
- Is it possible to route requests to multiple domains? HOT 1
- Is it possible to create end-point along proxying request to upstream services. HOT 1
- Catching WebSocketException HOT 1
- How to set proxy IP with webapi in upstream request? HOT 2
- ForwardTo to a VPN with NetworkCredentials? HOT 1
- How to proxy requests with routing to controllers? HOT 1
- Does that API support to function as a normal http proxy (forward proxy)? HOT 1
- Caching Forwarded Responses HOT 2
- hey! guys, I proxy the web api, how can I delete the response header? HOT 1
- How to log errors? HOT 1
- Migrate to YARP - step by step HOT 1
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 proxykit.