user8585282
user8585282

Reputation: 29

Can you disable wagtail admin url?

Is it possible to completely disable url login of wagtail admin on production. as i want to setup a replicated environment in a Bastian box so i only allow my ip address when im making changes

Upvotes: 0

Views: 805

Answers (3)

Brian Tung
Brian Tung

Reputation: 852

@user8585282: If you're trying to filter URIs in Nginx, you can do so by editing the Nginx config file for you site (in Ubuntu it's at /etc/nginx/sites-enabled/my-project).

Then, in the server block, add the following code (you can use IPv4 and IPv6 with CIDR).

server {

...

    #restricts wagtail admin to this IP CIDR Block
    location = /admin {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
        allow XX.XX.XX.XX/24;
        deny all;
    }

    #restricts django admin to this IP CIDR Block
    location = /django-admin {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
        allow XX.XX.XX.XX/24;
        deny all;
    }

...

}

Upvotes: 0

Yet Another
Yet Another

Reputation: 11

You can blocking/allowing IP-addresses in Nginx

location /admin/ {
  allow XXX.XX.XX.XX;  ## Your specific IP
  deny all;
}

Upvotes: 1

Moritz
Moritz

Reputation: 3363

Have you tried removing the admin urls from your url config?

# urls.py
urlpatterns = [
    # uncomment the following line
    # url(r'^admin/', include(wagtailadmin_urls)),
    url(r'^documents/', include(wagtaildocs_urls)),

    # For anything not caught by a more specific rule above, hand over to
    # Wagtail's page serving mechanism. This should be the last pattern in
    # the list:
    url(r'', include(wagtail_urls)),

    # Alternatively, if you want Wagtail pages to be served from a subpath
    # of your site, rather than the site root:
    #    url(r'^pages/', include(wagtail_urls)),
]

Upvotes: 2

Related Questions