Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Error: Server cannot append header after HTTP headers have been sent #13

Closed
VanHelSeenG opened this issue May 24, 2015 · 6 comments
Closed
Assignees
Labels
Milestone

Comments

@VanHelSeenG
Copy link

After some tests with turned on GZip compression I found what CompressionHandler generate this exception. An exception occurs most often during server get unauthorized requests and sometimes during authorized.I use ordinary OWIN OAuth. Exception also occurs when I send request to auth /token endpoint. I attached screenshot of stack trace(begin of it). Please, help with problem
image

@azzlack azzlack modified the milestone: 1.2.3 Jun 18, 2015
@azzlack azzlack added the bug label Jun 24, 2015
@azzlack
Copy link
Owner

azzlack commented Jun 24, 2015

This is related to OWIN: http://katanaproject.codeplex.com/discussions/540202

According to them, it is fixed in .NET 4.6, but I will see if I can find a workaround for this version.

@fr4nky80
Copy link

solution for this?

@pranaydutta89
Copy link

👍

@pcoulter
Copy link

pcoulter commented Nov 2, 2015

(bump)

@azzlack azzlack modified the milestone: 1.3.0 Dec 5, 2015
@azzlack azzlack self-assigned this Dec 5, 2015
@azzlack azzlack modified the milestone: 2.0.0 Dec 5, 2015
azzlack added a commit that referenced this issue Jan 28, 2016
@azzlack
Copy link
Owner

azzlack commented Jan 28, 2016

So. This will be solved by downloading an extra package that contains a special OwinServerCompressionHandler. This is a separate package because the base package does not require Owin.

@azzlack azzlack closed this as completed Jan 28, 2016
azzlack pushed a commit that referenced this issue Feb 8, 2016
@HughJeffner
Copy link

I have a somewhat strange setup using Owin + Identity + CookieAuthenticationMiddleware and the OwinServerCompressionHandler fails to detect the headers have already been sent. I use AuthenticationManager.SignIn and AuthenticationManager.SignOut methods in my controller and this is what ultimately modifies the headers by inserting some cookies into the response. The exception is thrown on a background thread and the set-cookie headers never make it into the response.

The current workaround is to disable compression for these methods which isn't a big deal. It just took many hours of detective work to figure out this module was the cause 🔍 😦

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants