My application GET
s the pages from a website and displays them in a localhost domain. but on specific websites (like habr) I receive a message like so:
the code which does all the stuff:
app.Run(async (context) =>
{
var url = context.Request.GetDisplayUrl()
.Replace(@"https://localhost:5001", "");
var request = (HttpWebRequest) WebRequest.Create(@"https://habr.com" + url);
var responce = (HttpWebResponse) request.GetResponse();
var resStream = responce.GetResponseStream();
var reader = new StreamReader(resStream);
await context.Response.WriteAsync(await reader.ReadToEndAsync());
});
and the CORS:
app.UseCors(builder =>
{
builder.DisallowCredentials();
builder.AllowAnyHeader();
builder.AllowAnyMethod();
builder.AllowAnyOrigin();
});
I've tried without DisallowCredentials
, but it didn't help. Tried to proxy StackOverflow, and it worked fine.