add url ignore feature and move functions to middleware.py