Closed
Description
Problem
The change in #179 can cause a performance issue.
I learned that lib/secure_headers/headers/content_security_policy.rb,
UserAgentParser.parse(@ua)
in supported_directives
is executed for each request.
As user_agent_parser's author is planning to remove, UserAgentParser.parse(@ua)
is problematic.
Because it loads common regexps yaml file as large as 4.7k lines on every call.
Possible solution
According to user_agent_parser's README's recommendation, we should instantiate a user_agent_parser by UserAgentParser::Parser.new
, then cache it.
So, which class / object should cache a user_agent_parser?
Metadata
Metadata
Assignees
Labels
No labels