Skip to content
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

Improve Nginx http accept regex #1387

Merged
merged 3 commits into from
Jan 19, 2025
Merged

Improve Nginx http accept regex #1387

merged 3 commits into from
Jan 19, 2025

Conversation

melroy89
Copy link
Member

@melroy89 melroy89 commented Jan 19, 2025

  • Combined the multiple valid accept headers into the same regex line (so we don't constantly need 3 lines), hence the (?:...|...|...) group
  • Be robust for an array of HTTP Accept headers (normally comma separated). Like Mastodon and Friendica is using, solving issue: ActivityPub services are using multi accept headers #1385 . Hence the additional .* regex.

Now all the AP requests are indeed getting logging correctly to the mbin_instance.log instead of the mbin_access.log (some examples below):

38.242.251.94 - - [19/Jan/2025:15:48:08 +0100]  "POST /f/inbox HTTP/1.1" 200 12 "-" "PeerTube/7.0.1 (+https://tilvids.com)" "kbin.melroy.org" 0.007
143.244.172.205 - - [19/Jan/2025:15:43:40 +0100]  "POST /f/inbox HTTP/1.1" 200 12 "-" "undefined/undefined (+http://a.gup.pe)" "kbin.melroy.org" 0.097
103.184.175.1 - - [19/Jan/2025:15:47:48 +0100]  "GET /f/object/66dfdf6f-9ca4-4c65-a754-9ea2015d787d HTTP/1.1" 200 12 "-" "Mastodon/4.4.0-mastau.1 (http.rb/5.2.0; +https://mastodon.au/)" "kbin.melroy.org" 0.004
178.21.23.139 - - [19/Jan/2025:15:48:13 +0100]  "GET /f/object/66dfdf6f-9ca4-4c65-a754-9ea2015d787d HTTP/1.1" 200 12 "-" "Akkoma 3.13.3-0-g963467f; https://fe.disroot.org <[email protected]>" "kbin.melroy.org" 0.005
65.109.234.6 - - [19/Jan/2025:15:47:31 +0100]  "GET /f/object/66dfdf6f-9ca4-4c65-a754-9ea2015d787d HTTP/1.1" 200 12 "-" "http.rb/5.1.1 (Mastodon/4.2.10; +https://mstdn.business/)" "kbin.melroy.org" 0.004
66.148.120.148 - - [19/Jan/2025:15:48:37 +0100]  "POST /i/inbox HTTP/1.1" 200 12 "-" "http.rb/5.1.1 (Mastodon/4.1.21; +https://mastodon.sdf.org/)" "kbin.melroy.org" 0.007
54.38.146.69 - - [19/Jan/2025:15:48:40 +0100]  "POST /i/inbox HTTP/1.1" 200 12 "-" "http.rb/5.1.1 (Mastodon/4.2.15; +https://mastodonapp.uk/)" "kbin.melroy.org" 0.007

Fixes: #1385

@melroy89 melroy89 added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Jan 19, 2025
@melroy89 melroy89 added this to the v1.8.0 milestone Jan 19, 2025
@melroy89
Copy link
Member Author

Tested and works now on my server (logs). And fixes indeed the issue.

@melroy89 melroy89 enabled auto-merge (squash) January 19, 2025 19:42
@melroy89 melroy89 disabled auto-merge January 19, 2025 19:51
@melroy89 melroy89 merged commit 6aacaa2 into main Jan 19, 2025
1 of 6 checks passed
@melroy89 melroy89 deleted the improve_nginx_regex branch January 19, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActivityPub services are using multi accept headers
2 participants