Upgrade url-pattern and support optional patterns.