I have fully completed the Installation step in installation document for TW 8.0 and also TW 7.4 (plus video) in my fresh machine with windows 7. and when reaching the step to launch, go to
in my browser (Chrome 59, Firefox 54, IE 11) only get redirected to localhost/Thingworx/home with blank white screen.
-Djava.library.path=C:Program FilesApache Software FoundationTomcat 9.0webappsThingworxWEB-INFextensions
then the last step is deploying thingworx.war file with apache server GUI (success with some tweaking in around maxpostinglimit)
2017-07-18 15:40:55.403+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ========================================
2017-07-18 15:40:55.404+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ThingWorx Version Information
2017-07-18 15:40:55.404+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ========================================
2017-07-18 15:40:55.406+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] majorVersion = 8
2017-07-18 15:40:55.406+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] minorVersion = 0
2017-07-18 15:40:55.406+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] revision = 1
2017-07-18 15:40:55.406+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] build = b39
2017-07-18 15:40:55.407+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] schemaVersion = 1000
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ========================================
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ========================================
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ThingWorx System Environment Settings
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ========================================
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] OS: Windows 7
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] OS arch: amd64
2017-07-18 15:40:55.408+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] OS version: 6.1
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Total Processors: 8
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Default encoding: UTF-8
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] JAVA vendor: Oracle Corporation
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] JAVA version: 1.8.0_131
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] JAVA install location: C:Program FilesJavajre1.8.0_131
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] JVM Max Memory: 4072 (MB)
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] ========================================
2017-07-18 15:40:55.410+0700 [L: INFO] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] WebApp starting…
2017-07-18 15:40:55.745+0700 [L: INFO] [O: c.t.s.ThingWorxServer] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] HA mode not enabled. Initializing and starting in standalone mode.
2017-07-18 15:40:55.746+0700 [L: INFO] [O: c.t.s.ThingWorxPersistenceHandler] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Default Persistence Provider Name = ThingworxPersistenceProvider
2017-07-18 15:40:55.746+0700 [L: INFO] [O: c.t.s.ThingWorxPersistenceHandler] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Default Persistence Provider Package Name = PostgresPersistenceProviderPackage
2017-07-18 15:40:55.755+0700 [L: INFO] [O: c.t.p.p.PostgresDatasource] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Reading configuration from configTableCol
2017-07-18 15:40:55.978+0700 [L: INFO] [O: c.t.s.ThingWorxServer] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Managers…INITIALIZED
2017-07-18 15:40:55.981+0700 [L: INFO] [O: c.t.s.ThingWorxServer] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Database initialization started…
2017-07-18 15:41:26.398+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#1] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@34a6964b — Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (3). Last acquisition attempt exception:
2017-07-18 15:41:26.399+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#1] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@d22ce38 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2017-07-18 15:41:26.399+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#2] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@23cf9c7b — Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (3). Last acquisition attempt exception:
2017-07-18 15:41:26.403+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#2] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@d22ce38 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2017-07-18 15:41:26.406+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#5] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@41754979 — Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (3). Last acquisition attempt exception:
2017-07-18 15:41:26.406+0700 [L: ERROR] [O: c.t.s.ThingWorxServer] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] [message: Connections could not be acquired from the underlying database!]
2017-07-18 15:41:26.406+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#5] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@d22ce38 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2017-07-18 15:41:26.411+0700 [L: INFO] [O: c.t.p.p.PersistenceProvider] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Connection ThingworxPersistenceProvider, type PostgresPersistenceProviderPackage stopped
2017-07-18 15:41:26.411+0700 [L: WARN] [O: c.t.p.p.PersistenceProvider] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] Could not find persistenceProviderPackage PostgresPersistenceProviderPackage and thus could not stop data processing
2017-07-18 15:41:26.413+0700 [L: ERROR] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] [message: Unable to initialize and start system: Connections could not be acquired from the underlying database!]
2017-07-18 15:41:26.413+0700 [L: ERROR] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-9] *** Web Application STATE is being set to ERROR! ***
2017-07-18 15:41:26.422+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#0] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@625ac15d — Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (3). Last acquisition attempt exception:
2017-07-18 15:41:26.422+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#0] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@d22ce38 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2017-07-18 15:41:26.428+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#6] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@624e1793 — Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (3). Last acquisition attempt exception:
2017-07-18 15:41:26.429+0700 [L: WARN] [O: c.m.v.r.BasicResourcePool] [I: ] [U: SuperUser] [S: ] [T: C3P0PooledConnectionPoolManager[identityToken->1hge1iz9pnjm6g61ngzq4t|a6b6c9e]-HelperThread-#6] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@d22ce38 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
2017-07-18 15:42:10.050+0700 [L: ERROR] [O: c.t.s.a.AuthenticationFilter] [I: ] [U: ] [S: ] [T: http-nio-80-exec-12] Could not handle request
2017-07-18 15:57:56.022+0700 [L: ERROR] [O: c.t.s.a.AuthenticationFilter] [I: ] [U: ] [S: ] [T: http-nio-80-exec-14] Could not handle request
2017-07-18 15:58:15.163+0700 [L: ERROR] [O: c.t.s.a.AuthenticationFilter] [I: ] [U: SuperUser] [S: ] [T: http-nio-80-exec-16] Could not handle request
2017-07-18 15:59:32.865+0700 [L: ERROR] [O: c.t.s.a.AuthenticationFilter] [I: ] [U: ] [S: ] [T: http-nio-80-exec-11] Could not handle request
thats is, really needed guidance here, i have tried every possible configuration i know, but had same result and sometimes even worse .
Hi,
I’m doing post request from Arduino GSM Shield 2 to Thingworx. Right now i want to remotely create a Thing. I’ve tried with POSTman, the Request is valid and from Postman I can create Thing. I’ve posted from shield another request to other page, and i know that shield is configured corectly. But when i do the same request from arduino i get 401 error.
My POST (Works in POSTMAN):
POST /Thingworx/Resources/EntityServices/Services/CreateThing?appKey=xxxx-xxx-xxxx-xxx-xxx&method=post&x-thingworx-session=true&name=NewThing&thingTemplateName=GenericThing HTTP/1.1
Host: pp-xxxxxxxxxxxx.devportal.ptc.io
Connection: close
Accept: application/json
Content-Type: application/json
And Response:
HTTP/1.1 401
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: frame-ancestors ‘self’
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Date: Tue, 16 Jul 2019 07:05:21 GMT
Connection: close
Can someone tell me wats wrong?
BaLahmuT 85 / 29 / 16 Регистрация: 01.06.2019 Сообщений: 609 |
||||||||||||
1 |
||||||||||||
14.04.2021, 22:01. Показов 9482. Ответов 8 Метки нет (Все метки)
Получаю погоду с api, при запуске представления вылетает ошибка: System.Net.WebException: «Удаленный сервер возвратил ошибку: (401) Несанкционированный.» Модель: Кликните здесь для просмотра всего текста
Контроллер: Кликните здесь для просмотра всего текста
Представление: Кликните здесь для просмотра всего текста
Миниатюры
0 |
648 / 582 / 171 Регистрация: 17.07.2012 Сообщений: 1,651 Записей в блоге: 1 |
|
14.04.2021, 23:25 |
2 |
Rudman132, 401 отдает API. Видимо ему ключ какой-то нужен.
1 |
BaLahmuT 85 / 29 / 16 Регистрация: 01.06.2019 Сообщений: 609 |
||||
15.04.2021, 15:13 [ТС] |
3 |
|||
Cupko, Хмм..странно, если api ключ вынести в отдельную переменную то все работает
0 |
972 / 639 / 160 Регистрация: 09.09.2011 Сообщений: 1,941 Записей в блоге: 2 |
|
15.04.2021, 18:47 |
4 |
Решение
странно, если api ключ вынести в отдельную переменную то все работает Ничего странного. Пропущен разделитель.
1 |
BaLahmuT 85 / 29 / 16 Регистрация: 01.06.2019 Сообщений: 609 |
||||||||
15.04.2021, 23:09 [ТС] |
5 |
|||||||
Вопрос такой, как привязать форму к api? чтоб город можно было указывать любой
Вот форма: Кликните здесь для просмотра всего текста
0 |
972 / 639 / 160 Регистрация: 09.09.2011 Сообщений: 1,941 Записей в блоге: 2 |
|
16.04.2021, 23:14 |
6 |
Вопрос такой, как привязать форму к api? чтоб город можно было указывать любой Я давно не работал с погодным апи. Но наверное это с ним и не должно быть связано. Форма — ввод города. Всё. Роль на этом заканчивается.
0 |
BaLahmuT 85 / 29 / 16 Регистрация: 01.06.2019 Сообщений: 609 |
||||
17.04.2021, 11:04 [ТС] |
7 |
|||
HF, Может неправильно сформулировал, имел ввиду: как текст из inputa подставить вместо
0 |
972 / 639 / 160 Регистрация: 09.09.2011 Сообщений: 1,941 Записей в блоге: 2 |
|
17.04.2021, 22:12 |
8 |
Решение
Может неправильно сформулировал, имел ввиду: как текст из inputa подставить вместо Судя по представлению — у вас запрос сразу уходит. Значит
0 |
85 / 29 / 16 Регистрация: 01.06.2019 Сообщений: 609 |
|
17.04.2021, 23:17 [ТС] |
9 |
HF, понял, спасибо!
0 |
Страница с ошибкой при обращении к WordPress-сайту всегда вызывает неудобства, вне зависимости от того, ваш это сайт или чужой. Как и в случае со многими другими кодами ответов HTTP, ошибка 401 не содержит детальных данных для диагностики и решения проблемы.
Ошибка 401 может появиться в любом браузере. В большинстве случаев ее легко решить.
В этой статье мы расскажем, что означает 401 ошибка, почему она происходит, и какие методы ее устранения существуют.
Итак, приступим!
Содержание
- Код ошибки 401 – что это?
- Что вызывает ошибку 401
- Как исправить ошибку 401 (5 методов)
Код ошибки 401 – что это?
Коды состояния HTTP 400 возникают в случае проблем с выполнением запросов. В частности, ошибка 401 появляется, когда браузер отказывает вам в доступе к странице, которую вы хотите посетить.
В результате вместо загрузки страниц браузер выведет сообщение об ошибке. Ошибки 401 могут возникать в любом браузере, потому отображаемое сообщение может варьироваться.
К примеру, в Chrome и Edge вы, скорее всего, увидите иконку бумаги с простым сообщением о том, что запрашиваемая страница не отвечает. Вы увидите фразу «HTTP Error 401». Вам будет предложено связаться с владельцем сайта, если ошибка не пропадет:
В иных случаях и в других браузерах вы можете получить менее дружелюбное предупреждение. К примеру, может выводиться пустая страница с сообщением «401 Authorization Required»:
Другие вариации текста:
- HTTP 401 Error – Unauthorized
- 401 Unauthorized
- Access Denied
Эти ошибки часто появляются на сайтах, где требуется вводить данные для входа. В большинстве случаев это означает, что что-то не так с учетными данными. Возможно, браузер перестал считать их действительными.
Эта ошибка похожа на HTTP 403 Forbidden Error, когда доступ к сайту для пользователя запрещен. Однако, в отличие от ошибки 403, сообщение об ошибке 401 указывает, что процесс аутентификации завершился неудачно.
Код ошибки передается через заголовок WWW-Authenticate, который отвечает за определение метода аутентификации, используемого для предоставления доступа к веб-странице или ресурсу.
Что вызывает ошибку 401
Если вы столкнулись с кодом ошибки в кодах 400, вы должны знать, что проблема произошла на стороне клиента (либо на стороне браузера). Случается, что виновником проблемы является браузер, но так бывает не всегда. Об этом мы еще расскажем позже.
Ошибки 401 возникают на ресурсах с ограниченным доступом – к примеру, на страницах, защищенных паролем. Потому можно предположить, что причина проблемы связана с данными аутентификации.
Устаревшие Cookie и кэш браузера
Одной из наиболее распространенных причин возникновения ошибки 401 является то, что кэш и файлы cookie вашего браузера устарели, что не позволяет выполнить авторизацию. Если ваш браузер использует недействительные данные для авторизации (либо вообще их не использует их), сервер отклонит запрос.
Несовместимые плагины
Также бывают ситуации, когда ошибка вызвана несовместимостью плагинов или какими-либо сбоями в них. К примеру, плагин безопасности может ошибочно принять вашу попытку входа за вредоносную активность, а потому будет возвращена ошибка 401 для защиты страницы.
Неверный URL или устаревшая ссылка
Бывает, что источником проблемы является незначительная оплошность. К примеру, был неверно введен URL, ссылка была устаревшей и т.д.
Как исправить ошибку 401 (5 методов)
Теперь, когда мы разобрались с причинами ошибки 401, пришло время обсудить, как ее устранить.
Давайте рассмотрим 5 методов, которые вы можете использовать.
- Проверьте ваш URL.
Начнем с самого простого потенциального решения: убедитесь, что вы использовали верный URL. Это может выглядеть банально, но 401 ошибки нередко появляются, если URL-адрес был введен неправильно.
Еще один вариант: ссылка, которую вы использовали для перехода на запрашиваемую страницу, указывает на неправильный URL. К примеру, ссылка устарела, ведет на страницу, которой больше нет (и редиректов не задано).
Стоит тщательно перепроверить URL-адрес, который вы использовали. Если вы набирали адрес самостоятельно, убедитесь, что все написано безошибочно. Если вы переходили по ссылке, убедитесь в том, что она ведет на страницу, к которой вы хотите получить доступ (либо попробуйте перейти на эту страницу непосредственно через сайт).
- Почистите кэш браузера.
Кэш браузера предназначен для улучшения процесса взаимодействия с сайтами в сети за счет сокращения времени загрузки страниц. К сожалению, иногда это может вести к нежелательным последствиям.
Как мы уже говорили выше, одной из распространенных причин появления ошибки 401 являются устаревшие или неправильные данные кэша или cookies. Потому, если URL введен верно, следующий шаг – чистка кэша браузера.
В итоге вы удалите любую недействительную информацию, которая хранится локально в вашем браузере и может приводить к прерываниям процесса аутентификации. Аналогично, файлы cookie вашего браузера могут содержать аутентификационные данные, которые нужно обновить.
Если вы пользуетесь Chrome, вам нужно щелкнуть по иконке с меню в правом верхнем углу браузера и выбрать пункт Settings. В разделе «Privacy and security» нажмите «Clear browsing data:»
Далее вводим URL требуемого сайта и очищаем для него данные.
В других браузерах процесс очистки кэша и cookie может отличаться. К примеру, в Firefox нужно щелкать по иконке с библиотекой и выбирать History > Clear Recent History:
Информацию по остальным браузерам вы можете найти в поисковиках.
- Очистка DNS.
Еще один метод, который вы можете попробовать для устранения ошибки 401 – это очистка DNS. Эта причина встречается относительно редко, но стоит попробовать и такой подход, особенно если первые два ничего не дали.
Чтобы очистить DNS, перейдите в Windows к меню «Пуск» и там уже введите в строку поиска cmd. Нажмите Enter. Откроется командная строка. Далее вставьте команду ipconfig/flushdns, после чего снова нажмите Enter.
Если вы пользуетесь Mac, вы можете открыть командную строку следующим образом: Finder > Applications > Utilities > Terminal.
Введите команду sudo killall -HUP mDNSResponder и нажмите Enter. Затем вы можете обновить страницу, чтобы посмотреть, пропала ли ошибка 401 или нет.
- Деактивируйте ваши плагины
Проблема может возникать и по вине плагинов.
Некоторые плагины, особенно связанные с безопасностью, могут выдавать ошибку 401 при подозрении на вредоносную активность. Также у них могут быть проблемы с совместимостью. Потому лучше всего деактивировать все плагины и посмотреть, будет ли страница работать.
Вы можете деактивировать все плагины разом, перейдя в раздел Plugins > Installed Plugins в консоли WordPress. Выберите все плагины и в меню Bulk Actions задайте Deactivate, после чего щелкните по кнопке Apply:
После этого попробуйте перезагрузить страницу с ошибкой. Если ошибка пропала, вы можете вручную по одному активировать плагины заново, чтобы выявить виновника всех бед.
Далее вы уже можете либо удалить плагин, либо написать его разработчикам, чтобы они предоставили рабочее решение.
- Проверьте заголовок WWW-Authenticate
Если проблема все еще остается, то в таком случае она может быть связана с ошибками на сервере. А значит, исправить ее будет чуть сложнее.
Как мы уже писали ранее, ответ 401 передается через заголовок WWW-Authenticate, который отображается как “WWW-Authenticate: <type> realm=<realm>”. Он включает в себя строки данных, указывающие на то, какой тип аутентификации требуется для предоставления доступа.
Вам нужно посмотреть, был ли отправлен ответ в WWW-Authenticate, а точнее какая схема аутентификации была использована. По крайней мере, это позволит вам приблизиться на один шаг к решению.
Перейдите на страницу с ошибкой 401 и откройте консоль разработчика в Chrome. Вы можете щелкнуть правой кнопкой мыши на странице и выбрать Inspect (Ctrl+Shift+J).
Далее перейдите на вкладку Network и перезагрузите страницу. Это позволит сгенерировать список ресурсов. Выберите заголовок Status, чтобы отсортировать таблицу, и найдите код 401:
Выберите данную запись, после чего перейдите на вкладку Headers. В Response Headers найдите заголовок WWW-Authenticate:
Информация, представленная в заголовке ответа, в частности, в схеме аутентификации, даст вам больше сведений о том, что произошло, и укажет на решение. Это позволит вам понять, какой тип аутентификации требуется серверу.
К примеру, в приведенном выше примере мы видим, что схема аутентификации задана как «Basic». Это означает, что запрос аутентификации требует только ID и password. Для получения более подробной информации и инструкций мы рекомендуем обратиться к HTTP Authentication Scheme Registry.
Источник: kinsta.com
Trying to access a site and being met with an error page is at best inconvenient, whether that site is yours or someone else’s. As with many HTTP response codes, part of what makes a 401 error so frustrating is the lack of information it offers for diagnosing and resolving the issue.
The 401 error can happen with any browser, so it’s a pretty common issue people face. In most cases, this problem is relatively simple and straightforward to fix.
In this post, we’ll explain what 401 error messages are and why they happen. Then, we’ll walk you through five methods you can use to fix them.
Let’s get started!
What is the 401 Error Code?
The Internet Engineering Task Force (IETF) defines the error 401 Unauthorized as:
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource. The server generating a 401 response MUST send a WWW-Authenticate header field containing at least one challenge applicable to the target resource.
An Introduction to the 401 Error Code
HTTP 400 status codes are encountered when there is a problem making a request. A 401 error, in particular, happens when your browser denies you access to the page you’re trying to visit.
As a result, instead of loading the web page, the browser will load an error message. 401 errors can happen within any browser so the message appearing may differ.
For example, in Chrome or Edge, you’ll likely see a paper icon along with a simple message telling you that the page in question isn’t working. It will include the phrase “HTTP Error 401” at the bottom, and instruct you to contact the site’s owner if the problem persists:
At other times and in other browsers, you might get a slightly less friendly warning that’s just a blank page with a “401 Authorization Required” message:
Other variations include:
- “HTTP 401 Error – Unauthorized”
- “401 Unauthorized”
- “Access Denied”
These errors occur on websites that require a login in order to access them. In most cases, it means that something is either wrong with the credentials or with the browser’s ability to read them as valid.
This is similar to HTTP 403 Forbidden Error, in that access isn’t permitted to the user. However, unlike with the 403 error, the 401 error message indicates that the authentication process failed.
The code is sent via the WWW-Authenticate header, which is responsible for identifying the authentication method used for granting access to a web page or resource.
Error Code | HTTP 401 Unauthorized Error |
Error Type | Commonly a client-side error |
Error Variations | 401 Authorization Required 401 Unauthorized HTTP 401 Error – Unauthorized Access Denied |
Error Causes | Outdated Browser Cache and Cookies Plugin Incompatibility Incorrect URL or Outdated Link |
The HTTP 401 error is all too common 🤦♀️ — and this guide will give you everything you need to fix it the next time you see that message showing up ✅Click to Tweet
What Causes a 401 Error?
If you encounter an error code in the 400s, you know you’re dealing with a client-side (or browser-side) issue. While the problem may be happening within your browser, however, it doesn’t necessarily always mean that’s the culprit, which we’ll explain in more detail later.
401 errors occur on restricted resources, such as password-protected pages of your WordPress site. So it’s safe to assume that the cause of the problem has something to do with the authentication credentials.
Outdated Browser Cache and Cookies
One of the most common reasons you might experience a 401 error is that your browser’s cache and cookies are out of date, preventing the authorization from successfully going through. If your browser isn’t using the valid authentication credentials (or any at all), the server will reject the request.
Plugin Incompatibility
At other times, this error is caused by a plugin incompatibility or error. For example, a firewall or security plugin can mistake your login attempt as malicious activity, and return a 401 error to protect the page.
Incorrect URL or Outdated Link
It’s also possible that the source of the problem can be attributed to a minor mistake. Common culprits in this category include an incorrectly-typed URL or an outdated link.
How to Fix the 401 Error?
Now that we’ve gone through a bit of background on the 401 error, it’s time to discuss how you can resolve it.
Let’s take a look at five methods you can use:
1. Look for Errors in the URL
We’ll start off with the easiest potential fix: making sure you used the correct URL. This may sound simple, but 401 errors can sometimes appear if the URL wasn’t correctly entered in.
Another possibility is that the link you used to visit the page in question points to the wrong URL. For example, it might be outdated, or leading to a page that no longer exists (and no redirects are in place).
Therefore, it’s worth double-checking the URL you used. If you typed it in yourself, verify that you spelled everything correctly. If you clicked on a link, confirm that it’s pointing to the page you’re trying to access (or try to visit that page directly through the website).
2. Clear Your Browser’s Cache
Your browser’s cache is designed to improve your online experience, by reducing page loading times. Unfortunately, sometimes it can also cause unwanted interruptions.
As we mentioned earlier, one of the common causes of the 401 error is outdated or incorrect cache data or cookies. Therefore, if you don’t notice any issues with the page’s URL, the next step is to clear your browser’s cache.
This will clean out any invalid information that’s locally stored in your browser, which could be interrupting the authentication process. Similarly, your browser’s cookies might contain authentication data that simply needs to be refreshed.
If you’re a Google Chrome user, you can do this by clicking on the menu icon in the top-right corner of the browser, and then going to Settings. Under the Privacy and security section, click on Clear browsing data:
A new window will open. Under the Basic tab, make sure all three boxes are selected, and then select Clear data:
This process will look a little different in other browsers. For example, in Mozilla Firefox, you would click on the library icon in the top-right corner of the browser, followed by History > Clear Recent History:
In the panel that opens next, select Everything in the drop-down menu at the top, make sure “Cache” is selected, and then click on the Clear Now button:
If you’re using a different browser, please refer to this guide for clearing the cache
3. Flush Your DNS
Another method you can try to resolve the 401 error is flushing your Domain Name Server (DNS). While this is a rarer issue, it can be a possible cause, so it’s worth giving it a try if the first two solutions don’t work.
To do this in Windows, click on the Start button and type cmd
into the search bar. Hit Enter, and the Command Prompt will open. Copy and paste the command ipconfig/flushdns
, and then hit Enter again:
On a Mac, you can do this by going to Finder > Applications > Utilities > Terminal:
Input the command line sudo killall -HUP mDNSResponder
and press Enter. Then, you can try refreshing the page you were trying to visit, to see if the 401 error has been resolved.
4. Deactivate Your WordPress Plugins
The problem causing your 401 error might not be due to your browser. If you’re having trouble accessing your WordPress site, it’s also possible that one or more plugins are to blame.
Some plugins, especially security-focused plugins, are configured to show a 401 error when they suspect suspicious login activity that might indicate an attack. Others might just be suffering from compatibility issues. Therefore, it’s a good idea to deactivate all of your WordPress plugins and see if that resolves the issue.
You can deactivate your plugins all at the same time in your dashboard, by going to Plugins > Installed Plugins. Check the box at the top to select all of them. Then under the Bulk Actions drop-down menu, select Deactivate and click on the Apply button:
After that, try reloading the page that returned the 401 error to see if this has resolved the issue. If it has, you can manually activate each plugin one at a time, in order to determine which one is causing the problem.
Then you can remove that plugin, replace it with a new one, or contact its developer for assistance.
5. Check the WWW-Authenticate Header Response
At this point, if the issue hasn’t been fixed, it may be caused by a server-side problem. This means our last fix will be a bit more involved.
As we saw earlier, the 401 response is sent through the WWW-Authenticate header, which appears as “WWW-Authenticate: <type> realm=<realm>”. It includes ‘challenges’, or strings of data that indicate what type of authentication is required in order for access to be granted.
In a nutshell, you’ll want to check and see if the header response was sent, and more specifically, what authentication scheme was used. At the very least, this can help narrow down the cause of the problem, and bring you one step closer to a solution.
To do this, go to the web page that’s displaying the 401 error, and access the developer console in Chrome. You can right-click on the page and select Inspect, or use Ctrl+Shift+J.
Next, click on the Network tab and reload the page. This will generate a list of resources. Select the Status header to sort the table and locate the 401 status code:
Select that entry, and then click on the Headers tab. Under Response Headers, locate the WWW-Authenticate header:
The information that is present in the response header, particularly the authentication schemes, can give you more information about what’s happening and point you towards a solution. It can help you understand what type of authentication the server is expecting.
For example, in the above example, we can see that the authentication scheme is “Basic”. This means the authentication request should only require an ID and password. For more detailed information and instructions on how to use this information, we recommend referring to the HTTP Authentication Scheme Registry.
HTTP 401 errors, begone! 🧙♂️ 5 ways to stop those pesky messages (no magic required) ✨Click to Tweet
Summary
When your browser and server have trouble communicating or authenticating requests, you’re sometimes forced to deal with errors such as the 401 error. While this problem is irritating, the message is usually temporary and fixable.
Here are five methods you can use to fix the 401 error:
- Look for errors in the URL.
- Clear your browser’s cache.
- Flush your DNS.
- Deactivate your WordPress plugins.
- Check the WWW-Authenticate header response.