Categories
Mastering Development System & Network

ERR_CERT_COMMON_NAME_INVALID on chrome

When trying to login to my website on Chrome based browsers I get the error: Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID On firefox it works fine, tho. I installed certificates by certbot. My corresponding nginx settings look like: server { listen 80; server_name pvapp.umwelt-campus.de; return 302 https://$server_name$request_uri; } server{ # SSL configuration listen 443 ssl default_server; […]

Categories
Mastering Development

Django + React Able to create new user in database, but token-auth returns 400 bad request

So I have an app that I’m writing. It’s working, for the most part, so far. I only currently have a login and signup setup, with a ‘homepage’ that just has a logout button and some text on it so I can test. When I do signup, it posts the user to the database, but […]

Categories
Mastering Development

django-cors-headers not work in for patch method

INSTALLED_APPS = [ # default django apps ‘jazzmin’, ‘django.contrib.admin’, ‘django.contrib.auth’, ‘django.contrib.contenttypes’, ‘django.contrib.sessions’, ‘django.contrib.messages’, ‘django.contrib.staticfiles’, # Optional: Django admin theme (must be before django.contrib.admin) ‘rest_framework’, ‘rest_framework_simplejwt.token_blacklist’, ‘corsheaders’, ‘treebeard’, ‘UserAccount.apps.UseraccountConfig’, ‘CompanyInfo.apps.CompanyInfoConfig’, ‘Backup.apps.BackupConfig’, ‘FinancialPeriod’, ‘Inventory.apps.InventoryConfig’, ‘Product.apps.ProductConfig’, ] MIDDLEWARE = [ ‘corsheaders.middleware.CorsMiddleware’, ‘django.middleware.security.SecurityMiddleware’, ‘django.contrib.sessions.middleware.SessionMiddleware’, ‘django.middleware.common.CommonMiddleware’, ‘django.middleware.csrf.CsrfViewMiddleware’, ‘django.contrib.auth.middleware.AuthenticationMiddleware’, ‘django.contrib.messages.middleware.MessageMiddleware’, ‘django.middleware.clickjacking.XFrameOptionsMiddleware’, ] CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_CREDENTIALS = False default_headers = ( […]

Categories
Mastering Development System & Network

cors header wasn’t set in request although apache server was configured

can anyone point me why my request header wasn’t set with cors header although in apache httpd.conf was configured just to do that. Am I missing something here ?? Thanks in advance. <Directory "${SRVROOT}/htdocs"> Header set Access-Control-Allow-Origin "some url" Header set Access-Control-Allow-Headers "Accept, Accept-Charset, Accept-Encoding, Accept-Language, Connection, Content-Type, Cookie, DNT, Host, Keep-Alive, Origin, Referer, User-Agent, […]

Categories
Development System & Network

Getting full rest HTTP methods to work with nginx index directive

I’ve been trying to update my API to be fully REST compliant, and I haven’t been able to get DELETE, PUT, OPTION etc to work with the index directive. I’ve tried every config I can find on here and I can’t figure out what I’m doing wrong. The methods work fine if I do the […]

Categories
Development

django & javascript fetch(): CORS policy: No ‘Access-Control-Allow-Origin’ header is present

I am trying to make an ajax call. I am using django 2.2.5 and cors 3.1.0, but getting the following error messages in the browser console: Access to fetch at ‘http://my.domain.com/‘ from origin ‘http://127.0.0.1:8000‘ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your […]