Seems to be messing with CORS for me
Silver-Golden opened this issue · 7 comments
It seems that some cors preflight requests are failing for me when I enable the cache (namely LibreOffice)
Cache config
http_cache {
cache_type file
path /tmp/cache
match_path /
}
log without cache
withoutCache.txt
Log with cache enabled
withCache.txt
My brain is a tad friend at the moment but could you shed any light on it?
Hi @Silver-Golden ,
I've seen the two log files and I found the log without cache enabled. The requests were still failed without the cache. Currently, I don't have a clue why you encounter this problem.
It's better if you could provide an example to reproduce this issue. Thx!
So I have been digging into it.
When I send a HEAD request my server responds with a 405.
If the cache is turned on this response is not sent to the client, if it is off it does go to the client and the client tries to keep the connection open until it times out.
To be extra sure I booted up caddy v1 with https://github.com/nicolasazrak/caddy-cache to see how it would respond.
Caddy-cache does send the HEAD 405 to the client.
Something in your implemtation seems to not like HEAD methods.
Hi, @Silver-Golden .
Sorry for response late. Recently, I am a little busy. I've written a little example to simulate the situation you mentioned. It will not return the head 405 to the client as you sad In the release v0.2.0.
I've already fixed it in the later version and test it under the latest release (v0.3.1). I am sure it will be alright.
I hope this will solve your problem.
No worries about the delay, it happens all of us.
Tried v0.3.1 and no improvement.
Here are the logs where I break it down by method: https://gist.github.com/Silver-Golden/e55f42073ca9d29e872de99be29fcd39
Hi, @Silver-Golden
I did not notice that you using the file cache. After testing the file cache, the problem still exists! I push the latest code (here is the PR: #13 )to fix the problem and the newest release is v0.3.2
Just tested it and #13 seems to have solved it, cache is enabled and it is properly returning the HEAD.
Thanks for solving it.
Thanks for your testing!