The problem was the missing line inside contact page as seen in the page's source code:
My solution was to overwrite the form.php file of the contact module inside my custom theme so it could generate the line marked in the above picture.
After that I ran the command: ./magento setup:di:compile