Skip to content

Instantly share code, notes, and snippets.

@alshf89 alshf89/Readme.md
Last active Jul 13, 2019

Embed
What would you like to do?
Add BasicAuth to Postman Published Collection on Custom Domains

set NS TXT RECORD that provided by Postman for your custom domain in DNS resolver (Bind, Route53, ...) and handle CNAME Record redirection with Nginx.

for example if you have a custom sub domain (ex: docs.example.com) that you want to show your Postman Published collections you should set a CNAME record which point to your host instead of phs.getpostman.com so we can handle it with Nginx rather than DNS resolver.

# IF you want to Setup ON SSL Configuration
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name docs.example.com;
# SSL Configuration
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers HIGH:!aNULL:!MD5;
auth_basic "Restricted Area";
auth_basic_user_file /path/to/.htpasswd;
location / {
proxy_pass https://phs.getpostman.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_intercept_errors on;
}
}
# IF you want to Setup ON non-SSL Configuration
server {
listen 80;
listen [::]:80;
server_name docs.example.com;
auth_basic "Restricted Area";
auth_basic_user_file /path/to/.htpasswd;
location / {
proxy_pass https://phs.getpostman.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_intercept_errors on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.