# \[KC 17.x.x\] How to access admin UI from port-forwarded/internal URL / prevent redirect from internal url to KC\_HOSTNAME

**URL:** <https://forum.keycloak.org/t/kc-17-x-x-how-to-access-admin-ui-from-port-forwarded-internal-url-prevent-redirect-from-internal-url-to-kc-hostname/14917>\
**Category:** Configuring the server\
**Tags:** admin-console\
**Created:** [April 12, 2022, 7:14am UTC](https://forum.keycloak.org/t/kc-17-x-x-how-to-access-admin-ui-from-port-forwarded-internal-url-prevent-redirect-from-internal-url-to-kc-hostname/14917 "2022-04-12T07:14:34Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![wadahiro](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/wadahiro/32/5579_2.png) [@wadahiro](https://forum.keycloak.org/u/wadahiro)\
**Post date:** [April 13, 2022, 3:06pm UTC](https://forum.keycloak.org/t/kc-17-x-x-how-to-access-admin-ui-from-port-forwarded-internal-url-prevent-redirect-from-internal-url-to-kc-hostname/14917/8 "2022-04-13T15:06:50Z")

</div>

One thing I forgot to mention: set the “frontend URL” in the master realm to the admin URL (Note: you need the scheme here like http(s)://〜).

Reference: [frontendUrl and adminUrl - how to restrict admin console to internal IP only?](http://forum.keycloak.org/t/frontendurl-and-adminurl-how-to-restrict-admin-console-to-internal-ip-only/2655)

However, changing the port number require a slightly tricky configuration. if you want to use localhost:8080 and localhost:8081, start with the following command, then add “[http://localhost:8081](http://localhost:8081)” to the “frontend URL” of the master realm.

`docker run -e KC_HOSTNAME=localhost -e KC_HOSTNAME_PORT=8080 -e KC_SPI_HOSTNAME_DEFAULT_ADMIN=localhost -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -p 8080:8080 -p 8081:8080 quay.io/keycloak/keycloak:17.0.1 start-dev`

---

_[View the full topic](https://forum.keycloak.org/t/kc-17-x-x-how-to-access-admin-ui-from-port-forwarded-internal-url-prevent-redirect-from-internal-url-to-kc-hostname/14917)._
