# Can I Publish my Collection's Documentation But Restrict Who Can Access It?

**URL:** <https://community.postman.com/t/can-i-publish-my-collections-documentation-but-restrict-who-can-access-it/1663>\
**Category:** Help Hub\
**Tags:** documentation\
**Created:** [May 21, 2018, 6:12pm UTC](https://community.postman.com/t/can-i-publish-my-collections-documentation-but-restrict-who-can-access-it/1663 "2018-05-21T18:12:31Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![alshf89](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@alshf89](https://community.postman.com/u/alshf89)\
**Post date:** [July 13, 2019, 9:32am UTC](https://community.postman.com/t/can-i-publish-my-collections-documentation-but-restrict-who-can-access-it/1663/5 "2019-07-13T09:32:59Z")

</div>

Guys I fixed it with some NGINX configuration and BasicAuth, I set TXT RECORD that provided by Postman for my domain in DNS resolver (Bind, Route53, …) and handle CNAME Record redirection with NGINX.

for example if you have a sub domain (ex: [docs.example.com](http://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](http://phs.getpostman.com) so we can handle it with NGINX rather than DNS resolver.

So Now create an NGINX conf in `/etc/nginx/conf.d` or anywhere you install NGINX:

> you can check these configuration on my Github gist [Add BasicAuth to Postman Published Collection on Custom Domains · GitHub](https://gist.github.com/alshf89/8a7f34a13e87302306c7810406fba4a9)

```nginx
# 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;
    }
}

```

Hope it helps someone.

---

_[View the full topic](https://community.postman.com/t/can-i-publish-my-collections-documentation-but-restrict-who-can-access-it/1663)._
