Skip to content

Instantly share code, notes, and snippets.

View subhanshuja's full-sized avatar
🏠
Working from home

Subhan Nooriansyah subhanshuja

🏠
Working from home
View GitHub Profile
@subhanshuja
subhanshuja / laravel-nginx-config-make-http-exception-url-and-make-all-others-https.md Laravel nginx config to redirect all requests to https and an exception URL that can still be accessible via http

Pre-condition

One day in your Laravel app, you were required to redirect all http requests to https but need to make a certain URL route accessible via http for a certain reason; perhaps a portion of your javascript code needs to redirect to http URL but it can't because redirection to secure URL to insecure is prohibited. Therefore, in cases like this, you need to just allow just one URL to make an http connection.

NOTE: There are obvious security implications here so don't just follow this blindly and understand if this is really the solution you're looking for. The nginx config can somehow be improved, I just don't have the time yet. It sure do look redundant.

Understanding and examples

  • Redirect everything from http to https
@subhanshuja
subhanshuja / build_nginx.sh
Created August 13, 2020 01:14 — forked from Yinchie/build-nginx.sh
Compiling NGiNX with OpenSSL TLS1.3, Brotli, more_headers, NAXSI - Ubuntu 18.04 x64
#!/usr/bin/env bash
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use the root user to install the software."
exit 1
fi
# Make script exit if a simple command fails and
# Make script print commands being executed
@subhanshuja
subhanshuja / adam_lbfgs_compare.py
Created December 27, 2017 03:30 — forked from glennq/adam_lbfgs_compare.py
Benchmarks for learning rate updating schemes in MLP
import numpy as np
from time import time
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.neural_network import MLPClassifier