Categories
Mastering Development System & Network

Nginx as a chain proxy with stunnel+pproxy+tor for add|set http headers responds with 400 status code

My initial goal is creating working http(ssl) proxy based on TOR socks5 connection first I up python-proxy with self-signed key then chained stunnel for securing connection, it works but cannot handle wss connection and seems like needs this headers patch ‘Access-Control-Allow-Origin’ ‘*’ … I didn’t find info how to do that using stunnel config, so […]

Categories
Mastering Development System & Network

Nginx reverse proxy and a URL rewrite

I would like to rewrite the URL in a reverse proxy so that it removes the first segment but leaves any following segments intact. I need this to happen before it hits the proxy pass. Example: /admin/auth/local —-> (REWRITES TO) /auth/local /admin/auth/register ——-> (REWRITES TO) /auth/register My Location block: location /admin { #add_header Access-Control-Allow-Origin *; […]

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 System & Network

Angular CORS with Nginx

Several questions for the same topic on the net but nothing worked. I have a serverXYZ running an Angular app, a backend tomcat webapp for authentication, a nginx server. Angular app on port 4200, tomcat app on 8080. Everything is on the same host. The angular app has a environment.ts file (the commented string is […]

Categories
Mastering Development System & Network

Nginx – Unable to fix CORS error on HTTPS – only works for http

I have a website running on a Nginx + Php-FM + Redis Stack . Was getting some CORS warnings and added the following to my nginx config : location / { if ($request_method = ‘OPTIONS’) { add_header ‘Access-Control-Allow-Origin’ ‘origin-list’; add_header ‘Access-Control-Allow-Origin’ ‘*’; add_header ‘Access-Control-Allow-Methods’ ‘GET, POST, OPTIONS’; # # Custom headers and headers various browsers […]

Categories
Mastering Development

Using Bottleneck to rate-limit API requests in a library

I am writing an API wrapper in TypeScript. I would like the code to be asynchronous in order to maximally meet the rate limit of the API in question. The API wants requests to be submitted at a maximum rate of 1/second. I intend to implement an API wrapper which is instantiated once, and allows […]

Categories
Mastering Development System & Network

Access denied (SA doesn’t have storage.objects.create access) when trying to upload using a preSigned url to google cloud storage

Having issues trying to allow a client to upload a file via a presigned url. Error received <?xml version=’1.0′ encoding=’UTF-8′?> <Error> <Code>AccessDenied</Code> <Message>Access denied.</Message> <Details> urlsigner@<project>.iam.gserviceaccount.com does not have storage.objects.create access to <bucket-name>/<filename>.pdf. </Details> </Error> Code executes as a gcp cloud function and is used for generating. Cloud function is default service account function was […]

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

Access denied (SA doesn’t have storage.objects.create access) when trying to upload using a preSigned url to google cloud storage

Having issues trying to allow a client to upload a file via a presigned url. Error received <?xml version=’1.0′ encoding=’UTF-8′?> <Error> <Code>AccessDenied</Code> <Message>Access denied.</Message> <Details> urlsigner@<project>.iam.gserviceaccount.com does not have storage.objects.create access to <bucket-name>/<filename>.pdf. </Details> </Error> Code executes as a gcp cloud function and is used for generating. Cloud function is default service account function was […]