标签: http-status-code-405

错误HTTP/1.0 405方法不允许

我想做一个Htttp连接这是我的代码

try
{
HttpClient client = new DefaultHttpClient();
HttpPost httpMethod = new HttpPost("http://www.google.co.in/");
String requestBody = "some text";
HttpMethod.setEntity(new StringEntity(requestBody));
HttpResponse response = client.execute(httpMethod);
textView.setText(response.getStatusLine().toString());
}
Run Code Online (Sandbox Code Playgroud)

但我无法得到"HTTP/1.0 405方法不允许"错误,我将感谢你的帮助

android http-status-code-405

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

在AWS CloudFront上启用POST/PUT/DELETE?

在AWS CloudFront中,我在"默认缓存行为设置"区域中设置了"允许的HTTP方法": GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE

我的CloudFront链接到AWS S3存储桶.所以我将AWS S3 CORS配置设置为:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>Authorization</AllowedHeader>
    </CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)

我当前的AWS S3存储桶策略是:

{
    "Version": "2008-10-17",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::<bucket_name_here>/*"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,当curl我遇到:

$ curl -I -s -X POST -H "Origin: www.example.com" [hash_here].cloudfront.net
HTTP/1.1 405 Method Not Allowed
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services cors http-status-code-405 amazon-cloudfront

9
推荐指数
1
解决办法
4029
查看次数

Heroku和Django有405错误

我试图将我的django项目从apache设置移动到heroku.在这一点上,除了使用PATCH Http方法(我与django-tastypie结合使用)时遇到的问题,一切似乎都运行正常.

我有一个允许这种方法的中间件,它在我以前的apache服务器上工作.现在我得到的是405(METHOD_NOT_ALLOWED)错误.常见的HTTP方法仍然有效(GET,POST,DELETE,POST).我还读过nginx默认不支持OPTIONS(可能还有PATCH请求?),必须进行一些配置.根据我的阅读,nginx为OPTIONS方法请求返回类似的405错误.我也很确定heroku使用nginx前端,所以这可能是问题所在.

这引出了我的下一个问题:我不知道如何添加自己的标题,因为这完全由heroku控制.有谁知道究竟是什么问题?有没有办法,除了放弃PATCH方法(这使事情更方便),让PATCH方法在heroku上工作?

django http heroku http-status-code-405 tastypie

8
推荐指数
1
解决办法
1346
查看次数

Next.js 和 Ant Design Dragger:部署实例上的文件上传失败

我正在尝试使用 React 使用 Next.js 和 Ant Design 构建文件上传。

在本地主机上,一切正常。当我部署实例并尝试上传文件时,出现以下错误:

Request URL: https://my-app.my-team.now.sh/url/for/test/
Request Method: POST
Status Code: 405 
Remote Address: 34.65.228.161:443
Referrer Policy: no-referrer-when-downgrade
Run Code Online (Sandbox Code Playgroud)

我使用的 UI 如下所示:

Request URL: https://my-app.my-team.now.sh/url/for/test/
Request Method: POST
Status Code: 405 
Remote Address: 34.65.228.161:443
Referrer Policy: no-referrer-when-downgrade
Run Code Online (Sandbox Code Playgroud)

在哪fileUploadProps

<Dragger {...fileUploadProps}>{renderImageUploadText()}</Dragger>
Run Code Online (Sandbox Code Playgroud)

我想,这与 Next.js 的服务器端渲染有关?另一方面,它可能不会,因为当我导航到url/for/test它时,它应该在客户端上呈现。

如何使用 Ant Design 和 Next.js 实现文件上传?

file-upload http-status-code-405 next.js antd

8
推荐指数
2
解决办法
4524
查看次数

WCF请求失败,HTTP状态为405:方法不允许

我有一个WCF服务,该服务已托管在Windows服务上,并使用BasicHttp端点为已连接到它的Windows Mobile设备提供服务.

问题是使用设备模拟器.我可以连接到服务并使用它没有任何问题,但使用实际的设备.我收到错误:

WCF请求失败,HTTP状态为405:方法不允许.

我使用以下代码来实现该服务.

BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.UseDefaultWebProxy = false;

m_ServiceHost.AddServiceEndpoint(typeof(IKooft), basicHttpBinding, "KooftService");
m_ServiceHost.Open();
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?

wcf http-status-code-405

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

什么可以导致IIS接收HTTP动词"2GET"

我有一个用户在单击我的应用程序中的链接时间歇性地接收HTTP 405.据我所知,链接没什么好笑的......

<a id="ctl00_ctlNavigationMenu_viewTransfersLink" href="Navigate.ashx?target=6">- View Transfers</a>
Run Code Online (Sandbox Code Playgroud)

正如我所说,大多数时候链接成功执行.然而,非常偶然的用户已被满足:

405 - 不允许用于访问此页面的HTTP动词.

当我检查IIS日志时,我可以看到以下条目:

2009-02-04 15:12:50 192.168.202.204 2GET /Navigate.ashx target=6 80 - 192.168.202.141 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322;+InfoPath.2;+.NET+CLR+2.0.50727) 405 0 1 13203
Run Code Online (Sandbox Code Playgroud)

这似乎是报告用户的浏览器使用动词2GET提交了请求.怎么会这样?

通过我们的测试服务器上的日志,我可以看到此问题的一些其他实例:

2008-11-06 13:30:10 192.168.202.204 2GET /Content/Css/origo_advanced_horiz.css - 80 - 192.168.202.190 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) 405 0 1 109
2008-11-06 13:31:44 192.168.202.204 2GET /Content/Css/origo_advanced_horiz.css - 80 - 192.168.202.190 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) 405 0 1 62
2008-11-06 13:37:20 192.168.202.204 2GET /Content/Css/datepicker.css - 80 - 192.168.202.190 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) 405 0 1 109
2008-11-06 14:06:00 192.168.202.204 2GET /Content/Css/origo_advanced_horiz.css - 80 - …
Run Code Online (Sandbox Code Playgroud)

asp.net http http-status-code-405

7
推荐指数
1
解决办法
1105
查看次数

WebRequest"HEAD"轻量级替代品

我最近发现以下内容不适用于某些网站,例如IMDB.com.

class Program
    {
        static void Main(string[] args)
        {
            try
            {
                System.Net.WebRequest wc = System.Net.WebRequest.Create("http://www.imdb.com"); //args[0]);

                ((HttpWebRequest)wc).UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/0.2.153.1 Safari/525.19";
                wc.Timeout = 1000;
                wc.Method = "HEAD";
                WebResponse res = wc.GetResponse();
                var streamReader = new System.IO.StreamReader(res.GetResponseStream());

                Console.WriteLine(streamReader.ReadToEnd());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

它返回HTTP 405(Method Not Allowed).我的问题是,我使用与上面非常相似的代码来检查链接是否有效以及绝大多数时候它是否正常工作.我可以将它切换到等于GET的方法并且它可以工作(增加超时),但这会使事情减慢一个数量级.我假设405响应是IMDB服务器端的服务器配置.

有没有办法让我在.NET中以轻量级的方式做同样的事情?或者,有没有办法修复上面的代码,所以它作为一个与imdb一起使用的GET请求?

.net c# webrequest http-status-code-405

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

获取 org.apache.camel.component.http.HttpOperationFailedException 状态代码 405

我正在运行 servicemix 4.4.1。我正在尝试使用camel-http4 对网站进行http 调用。无论我尝试调用哪个网站,我都会收到此错误: org.apache.camel.RuntimeCamelException: org.apache.camel.component.http.HttpOperationFailedException: HTTP 操作失败调用http://servicemix.apache.org/downloads /servicemix-4.4.0.html状态代码:405

这是我的代码片段:

 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>
    <from uri="activemq://events1"/>
<setHeader headerName="CamelHttpMethod">
    <constant>POST</constant>
</setHeader>
    <to uri="http://servicemix.apache.org/downloads/servicemix-4.4.0.html"/>
    <to uri="log:events"/>
  </route>
</camelContext>
Run Code Online (Sandbox Code Playgroud)

我尝试过许多网站并尝试使用不同的 http 方法(post 与 get),但我不断收到相同的错误。任何想法?提前致谢。

apache-camel http-status-code-405 apache-servicemix

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

精简上传到S3存储桶获取405方法不允许错误

我一直在撞墙撞墙,完全被难倒了.我正在尝试使用FineUploader将文件直接上传到我的Amazon S3存储桶.我基本上已经从fineuploader.com网页(直接上传文件到Amazon S3)和服务器端PHP复制了代码.

当我尝试上传文件时,我看到签名端点的帖子似乎成功运行但是当它尝试上传到S3时,我得到405"方法不允许"错误.

HTML

<!DOCTYPE html>
<html >
<head >
    <meta charset = "utf-8" >
    <link href = "http://fineuploader.com/source/fineuploader-3.9.1.min.css" rel = "stylesheet" >
</head >
<body >
<div id = "fine-uploader" ></div >

<script src = "http://code.jquery.com/jquery-latest.js" ></script >
<script src = "js/uploader.js" ></script >
<script >
    $(document).ready(function () {
        $("#fine-uploader").fineUploaderS3({
            debug: true,
            request: {
                endpoint: 'upload.roughdrag.com',
                accessKey: 'AKIAJL37USSCV......'
            },

            signature: {
                endpoint: 'handlers/uploadHandler.php'
            },
            uploadSuccess: {
                endpoint: 'index.php'
            },
            iframeSupport: {
                localBlankPagePath: 'blank.html'
            },
            retry: {
                enableAuto: true …
Run Code Online (Sandbox Code Playgroud)

php file-upload amazon-s3 http-status-code-405 fine-uploader

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

Next.js 错误 405 方法不允许在表单提交(POST)后重定向

我向 next.js API 路由提交表单(POST 方法)。我处理正文的内容(存储表单的内容),然后我想重定向到感谢页面。

API 路线如下所示

export default async function handler(req, res) {
    const body = Object.assign({}, req.body)
    
    // ... do stuff
    
    res.redirect(307, "/thank-you")
Run Code Online (Sandbox Code Playgroud)

发生重定向时,我会看到一个错误页面,代码为 405。

http-status-code-405 next.js

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