Skip to content

Instantly share code, notes, and snippets.

Avatar
🔔

S J shijij

🔔
  • Canada
View GitHub Profile
@shijij
shijij / _TLDR_no_comment_version.conf
Last active Nov 21, 2020
Apache 2.4. Map subdomain to directory with mod_rewrite
View _TLDR_no_comment_version.conf
RewriteEngine On
RewriteMap lc int:tolower
RewriteCond %{HTTP_HOST} ^([^.]*)\.([^.]*)\.([^.]*)\.([^.]*)$
RewriteRule ^.*$ - [R=404,L]
RewriteCond %{REQUEST_URI} \/icons\/.*
RewriteRule ^.*$ - [L]
RewriteCond %{HTTP_HOST} ^([^.]*)\.([^.]*)\.([^.]*)$
@shijij
shijij / VerifyCsrfToken.php
Created Jul 25, 2019
Laravel skip/except CSRF verification by domain name (useful for multiple subdomains)
View VerifyCsrfToken.php
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
@shijij
shijij / WA_TAX_FOR_WC.csv
Created Feb 4, 2018
General Sales Tax Rate For Washington State, USA. Ready for Woocommerce Import
View WA_TAX_FOR_WC.csv
Country Code State ZipCode City Rate % Tax Name Priority Compound Shipping Tax Class
US WA 98001 KING COUNTY 10 US Sales Tax 1 1 1
US WA 98002 AUBURN (KING CO) 10 US Sales Tax 1 1 1
US WA 98003 FEDERAL WAY 10 US Sales Tax 1 1 1
US WA 98004 BELLEVUE 10 US Sales Tax 1 1 1
US WA 98005 BELLEVUE 10 US Sales Tax 1 1 1
US WA 98006 BELLEVUE 10 US Sales Tax 1 1 1
US WA 98007 BELLEVUE 10 US Sales Tax 1 1 1
US WA 98008 BELLEVUE 10 US Sales Tax 1 1 1
US WA 98009 BELLEVUE 10 US Sales Tax 1 1 1
@shijij
shijij / gist:54c9b21f26c08a15a70c182f03cb15b4
Created Nov 14, 2017
Nginx ssl reverse proxy with SNI
View gist:54c9b21f26c08a15a70c182f03cb15b4
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name yourdomain
ssl_certificate /etc/ssl/localcerts/yourdomain.crt;
ssl_certificate_key /etc/ssl/localcerts/yourdomain.key;
ssl_ecdh_curve prime256v1;
ssl_session_cache builtin:1000 shared:SSL:10m;
@shijij
shijij / .appendTo_apache2.conf
Last active Jan 29, 2022
Apache BasicAuth with MySQL (authn_dbd)
View .appendTo_apache2.conf
# Append to apache2.conf
# Dont forget to repalce [user] [password] [dbname] with you own info
# ref: https://httpd.apache.org/docs/2.4/mod/mod_dbd.html
# ref: https://httpd.apache.org/docs/2.4/mod/mod_authn_dbd.html
<IfModule mod_authn_dbd.c>
DBDriver mysql
DBDParams host=localhost,port=3306,user=apache,pass=apache,dbname=auth
DBDMin 2
DBDKeep 8