-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Support HEAD requests #5153
Comments
Macaron provides a very simple way to add HEAD methods to every GET method: m.SetAutoHead(true) Which should just provide HEAD support for every GET on that router. However, each GET method would have to be checked to ensure it's idempotent. Another option would be to add HEAD methods to select methods that are require it. |
GET request should always be idempotent (if not it should be fix) so using |
@sapk for HEAD it should probably be completely idempotent - GET doesn't always have to be completely idempotent due to tracking. If you're sure that the GETs are idempotent or idempotent enough then autohead should just solve this. |
@zeripath we shouldn't have action made when you click on a link or load ressources (that will generate a GET request) for security reason. If not we should fix it so I am ok for autohead. |
@sapk The below patch would be the correct place to call SetAutoHead.
I guess the question is what tests do we need to do to check that this is a safe option. |
[x]
):Not relevant
Description
I regularly toot links to my repositories on Mastodon. Of course, the Federation effect kicks in and tons of HEAD requests arrive on my front server.
While I was watching them fail with a 404, I was thinking about HEAD requests support. "Why ?" you might ask. Because one could want to have a card displayed below their toot with a preview image, the repository name and description.
Basically, Mastodon first fires a HEAD requests to make sure the link leads to somewhere. Then, when the HEAD request has been successfully executed, it fires a GET request to get the contents of the page and generate an embed for the said link as shown below:
As we can see in the cURL output below, a HEAD request fails even though the repository really exists.
PS: English is not my native language. Some sentences can look weird or not as crystal clear as I would like.
Screenshots
Not relevant
The text was updated successfully, but these errors were encountered: