标签: http-error

为什么我在 Azure 应用程序网关中看到 403 禁止?

无论我是否有侦听器 (443) 和规则,访问https://www.example.com时看到的错误是:

403 - Forbidden

You don't have permission to access / on this server.
Run Code Online (Sandbox Code Playgroud)

如果我在端口 443 上添加侦听器,附加有效的证书和规则,我会收到相同的错误消息。如果我挖掘 www.example.com,我可以看到它正在解析为应用程序网关的公共 IP。

http://www.example.com通过端口 80 上的侦听器按预期工作,并且规则将流量定向到托管 Apache 的后端虚拟机。

我应该补充一点,这是使用 Azure 门户进行设置的。我应该使用 PowerShell 吗?一些论坛认为该门户网站不稳定。

azure http-error azure-application-gateway

5
推荐指数
1
解决办法
4万
查看次数

目录 api 的 gsuite 服务帐户返回 http 400 错误:请求错误/输入无效

我已经开始开发一些 api 来在我的 G suite 目录中创建用户。我遵循了服务帐户教程以及python目录教程。我的代码非常简单,只是为了测试它如何工作。

from google.oauth2 import service_account
from googleapiclient.discovery import build
SCOPES = ['https://www.googleapis.com/auth/admin.directory.user']
SERVICE_ACCOUNT_FILE = 'file'
creds = service_account.Credentials.from_service_account_file(
    SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = build('admin', 'directory_v1', credentials=creds)
results = service.users().list(customer='i am not sure what customer is', maxResults=10, orderBy='email').execute() 
#this line produces the error.
#Vscode also states the service has no member users. But I did install all #the libraries
users = results.get('users', [])
print(users)
Run Code Online (Sandbox Code Playgroud)

对我来说,文档对大多数事情都不清楚。当我运行这个时我得到

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/admin/directory/v1/users?customer=students&maxResults=10&orderBy=email&alt=json returned "Bad …
Run Code Online (Sandbox Code Playgroud)

python google-api http-error service-accounts google-directory-api

5
推荐指数
1
解决办法
2554
查看次数

无法将带有 Poetry 的 Python 工件发布到 Google Artifact Registry,因为“HTTP 错误 413:请求实体太大”

我对诗歌的使用很陌生。我的需要只是将我的 Python 库推送到我的个人 Google Artifact 注册表中。\n启动这些命令后:

\n
poetry config virtualenvs.create false\npoetry config $repoName $urlOfTheRemoteArtifactRegistry\npoetry config http-basic.$repoName $userName $userPwd\npoetry publish -r $repoName --build\n
Run Code Online (Sandbox Code Playgroud)\n

我有这个堆栈错误:

\n
HTTP Error 413: Request Entity Too Large\n\n  at /usr/local/Cellar/poetry/1.1.7/libexec/lib/python3.9/site-packages/poetry/publishing/uploader.py:216 in _upload\n      212\xe2\x94\x82                     self._register(session, url)\n      213\xe2\x94\x82                 except HTTPError as e:\n      214\xe2\x94\x82                     raise UploadError(e)\n      215\xe2\x94\x82 \n    \xe2\x86\x92 216\xe2\x94\x82             raise UploadError(e)\n      217\xe2\x94\x82 \n      218\xe2\x94\x82     def _do_upload(\n      219\xe2\x94\x82         self, session, url, dry_run=False\n      220\xe2\x94\x82     ):  # type: (requests.Session, str, Optional[bool]) -> None\n
Run Code Online (Sandbox Code Playgroud)\n

413 HTTP 错误意味着我的有效负载太大,但实际上当我

\n
du -h d …
Run Code Online (Sandbox Code Playgroud)

python http-error google-cloud-platform python-poetry google-artifact-registry

5
推荐指数
1
解决办法
3685
查看次数

如何将401认证错误返回给RestSharp客户端?

在我的Mvc Api控制器中,如果用户无法进行身份验证,则抛出HttpException 401.但是,RestSharp客户端似乎将其转换为Http 500状态代码.

我希望能够从我的Mvc控制器中抛出HttpExceptions,并让RestSharp客户端在其StatusCode属性中保留原始错误.

此外,我注意到如果服务器未启动,当RestSharp客户端发出请求时,响应的状态代码为0,响应代码为Error.RestSharp是否应该不返回404 http错误代码?

我真正需要的是关于RestSharp如何与HttpCodes一起工作的一些文档.

更新了我的api控制器中的代码:

throw new HttpException((int)HttpStatusCode.Unauthorized, AuthenticationError);
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc http-error restsharp

4
推荐指数
2
解决办法
2万
查看次数

重定向+ 403错误

我正在寻找一种类似的方法:

return HttpResponseForbiddenRedirect(reverse("view_name"))
Run Code Online (Sandbox Code Playgroud)

一个HttpResponse,它重定向到一个视图(带有它的名字),但仍然抛出403错误

我试着这样做:

class HttpResponseForbiddenRedirect(HttpResponse):
    def __init__(self, redirect_to):
        super(HttpResponseForbiddenRedirect, self).__init__()
        self['Location'] = iri_to_uri(redirect_to)
        self.status_code = 403
Run Code Online (Sandbox Code Playgroud)

但它没有用.出于某种原因,我不明白,我没有得到任何内容

django redirect http-error http-status-code-403

4
推荐指数
1
解决办法
3811
查看次数

python 3,错误处理urllib请求

from difflib import *
import urllib.request,urllib.parse,urllib.error
from urllib.parse import unquote
import time
import pdb

try:
    file2 = urllib.request.Request('site goes here')
    file2.add_header("User-Agent", 'Opera/9.61 (Windows NT 5.1; U; en) Presto/2.1.1')
    ResponseData = urllib.request.urlopen(file2).read().decode("utf8", 'ignore')
except urllib.error.URLError as e: print('http'); ResponseData = ''
except socket.error as e: ResponseData = ''
except socket.timeout as e: ResponseData = ''
except UnicodeEncodeError as e: ResponseData = ''
except http.client.BadStatusLine as e: ResponseData = ''
except http.client.IncompleteRead as e: ResponseData = ''
except urllib.error.HTTPError as e: ResponseData …
Run Code Online (Sandbox Code Playgroud)

python urllib http-error

4
推荐指数
1
解决办法
2万
查看次数

为什么Google API V3不会让孩子们回归?

我想使用Python获取Google云端硬盘中给定文件夹中所有文件/文件夹的列表.我正在使用的电话是这样的:

query = parentID + " in parents"

response = service.files().list(q=query,
                                spaces='drive',
                                fields='files(id, name, parents)').execute()
Run Code Online (Sandbox Code Playgroud)

根据搜索文件文档和迁移到v3文档,我应该正确地执行它.但是当我运行代码时,我收到以下错误:

<HttpError 400 when requesting https://www.googleapis.com/drive/v3/files?q=[MY_PARENT_ID]+in+parents&spaces=drive&alt=json&fields=files%28id%2C+name%2C+parents%29 returned "Invalid Value">
Run Code Online (Sandbox Code Playgroud)

我的查询有什么问题,如何正确调用?

python google-api http-error google-drive-api google-api-python-client

4
推荐指数
1
解决办法
2307
查看次数

应该由Web服务器(IIS)阻止package.json

如果我尝试访问web.config服务器返回的消息HTTP Error 404.8 - Not Found(请求过滤模块配置为拒绝URL中包含hiddenSegment部分的路径。)

如果我尝试访问packages.config服务器返回的消息HTTP Error 404.7 - Not Found(请求过滤模块配置为拒绝文件扩展名。)

现在我知道为什么这两个被阻止/过滤了。但我不确定为什么package.json不是。

  1. 有人可以解释原因吗?
  2. 如果应该阻止它,我该怎么做,这样它不会影响.jsonWeb服务器(IIS)需要提供服务的其他文件吗?

asp.net iis json http-error package.json

4
推荐指数
1
解决办法
227
查看次数

在预检中使用HTTP 401的Ajax CORS请求

我现在挣扎了好几个小时.我想向另一个域发出一个简单的ajax请求,但始终获取http 401错误:

jQuery(document).ready(function($){
  var challengeid = $('#codepressHook').data('challengeid');
  var clicked = false;
  $('#codepressHook').click(function(){
    if(!clicked){
      $.ajax({
        url: "https://dev.radbonus.com/admin/affiliate-connections/retrieveSingle/"+challengeid+".json",
        method: "GET",
        dataType: "json",
        jsonp: false,
        contentType: "application/json",
        xhrFields: {
          withCredentials: true
        },
        beforeSend: function(xhr){
          xhr.setRequestHeader("Authorization", "Basic "+ btoa(username+":"+password));
        },
        success: function(data){
          $('#codepressHock').html(data.data.code);
        },
        error: function(error){
          alert(error);
        }
      });
    }
  });
});
Run Code Online (Sandbox Code Playgroud)

我在服务器端设置了所有相关的CORS头.这是网络流量:

Request URL:https://dev.radbonus.com/admin/affiliate-connections/retrieveSingle/45.json
Request Method:OPTIONS
Status Code:401 Unauthorized
Remote Address:185.102.94.230:443
Referrer Policy:no-referrer-when-downgrade

Response Headers
view source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Content-Type, X-Requested-With, Authorization, Origin
Access-Control-Allow-Methods:POST, GET, PUT, DELETE, OPTIONS
Access-Control-Allow-Origin:http://radbonus.com
Access-Control-Max-Age:31536000
Content-Length:463
Content-Type:text/html; charset=iso-8859-1
Date:Sat, …
Run Code Online (Sandbox Code Playgroud)

javascript ajax http-error cors

4
推荐指数
1
解决办法
2万
查看次数

为什么这个链接到JS文件返回Unauthorized,但它在HTML中有效?

有可能不允许人们查看我的网站的JS文件吗?

演示:http: //js.maxmind.com/js/geoip.js

如果您复制URl并将其粘贴到浏览器中,则会显示"未授权".但是如果你把它放在HTML中,它就会起作用.

我可以用我的code.js文件吗?

html javascript security http-error

3
推荐指数
1
解决办法
799
查看次数