标签: http-status-code-302

IIS 7+ MVC静态内容无法在登录页面上呈现(对于未经身份验证的用户)

我有一个登录页面,应该可供未经身份验证的用户使用.在我当地的ASP.Net开发服务器上,一切运行良好.但是,在IIS 7上部署时,所有静态内容(如图片和脚本)都不会下载.只有当用户第一次登录时才会返回图片和脚本.服务器为未经身份验证的用户返回HTTP 302.我正在使用表单身份验证和ASP.Net成员资格提供程序.

iis-7 forms-authentication http-status-code-302 asp.net-mvc-3 iis-8

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

为什么浏览器不遵循呈现的 GitHub README.md 上图像资源的 HTTP 302 重定向?

这个问题似乎是关于 GitHub 的,但实际上是关于 HTTP 和浏览器的。不幸的是,我只能用 GitHub 重现这个问题,所以我没有比我在下面提供的例子更简单的例子。

该问题可以通过访问https://github.com/lonelearner/img-load-issue来观察。未在呈现的自述文件中加载的图像是问题所在。

这是 README.md 中的 Markdown 代码。

Foo

<img src="https://github.com/lonelearner/img-load-issue/releases/download/v1.0.0/ulam.png" alt="Image of Ulam spiral">

Bar
Run Code Online (Sandbox Code Playgroud)

当我在浏览器 (Firefox) 上单击查看源代码时,我看到上面的降价已呈现为以下 HTML 代码。

<article class="markdown-body entry-content" itemprop="text">
<p>Foo</p>
<p><a href="https://github.com/lonelearner/img-load-issue/releases/download/v1.0.0/ulam.png" target="_blank"><img src="https://github.com/lonelearner/img-load-issue/releases/download/v1.0.0/ulam.png" alt="Image of Ulam spiral" style="max-width:100%;"></a></p>
<p>Bar</p>
</article>
Run Code Online (Sandbox Code Playgroud)

您可以通过转到https://github.com/lonelearner/img-load-issue/releases并单击ulam.png来验证图像是否确实存在。生成的 HTML 代码看起来也不错。为什么浏览器无法加载图像呢?

如果我在 jsfiddle 中插入相同的 HTML 代码,图像似乎加载正常。示例:https : //jsfiddle.net/qxybjwf1/

为什么这个图像在 jsfiddle.net 上加载得很好,但在 GitHub 上?

我在 Firefox 检查器的网络选项卡中检查了请求和响应标头。对 ulam.png 的 GET 请求返回

302 Found
Location: https://github-cloud.s3.amazonaws.com/releases/64644360/7e448240-57e5-11e6-8bda-58e154461718.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAISTNZFOVBIJMK3TQ%2F20160801%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20160801T072537Z&X-Amz-Expires=300&X-Amz-Signature=fb0e8423517a09b80624b3512f8ebeffc54cfb976e409379c532b4625b179095&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dulam.png&response-content-type=application%2Foctet-stream
Run Code Online (Sandbox Code Playgroud)

在网络选项卡中,我没有看到 Firefox 发出另一个请求来检索 amazonaws.com URL。为什么? …

browser http github http-status-code-302

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

OKHttp句柄302

每当我在站点上执行OKHttp Post请求时,响应代码为302,响应主体为:

<html>
    <head>
        <title>Object moved</title>
    </head>
    <body>
        <h2>Object moved to <a href="/GradebookSummary.aspx">here</a>.
       </h2>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

OkHttpClient client = new OkHttpClient().newBuilder()
                            .followRedirects(false)
                            .followSslRedirects(false)
                            .build();
                    MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
                    RequestBody body = RequestBody.create(mediaType, "checkCookiesEnabled=true&checkMobileDevice=false&checkStandaloneMode=false&checkTabletDevice=false&portalAccountUsername=username&portalAccountPassword=password");
                    Request request = new Request.Builder()
                            .url("https://hac.chicousd.org/LoginParent.aspx?page=GradebookSummary.aspx")
                            .post(body)
                            .addHeader("content-type", "application/x-www-form-urlencoded")
                            .addHeader("cache-control", "no-cache")
                            .build();

                    Response response = client.newCall(request).execute();
Run Code Online (Sandbox Code Playgroud)

我的问题是:如何处理回复才能转到新位置?

java android http-status-code-302 okhttp okhttp3

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

提取:边缘17中的状态302

我正在使用js fetch API从JSON检索数据。它工作正常(即使在IE 11中也是如此),除了在Edge 17中我得到302之外,响应标头是:

我的本地网站在Mac上,我正在使用BrowserSync通过192.168.100.X:3000进行访问,然后更新了PC主机文件,如下所示:

192.168.100.X  http://local.mysite.com
Run Code Online (Sandbox Code Playgroud)

这是我的访存电话:

   fetch('/fr/fil-actualites-json', { mode: 'cors' })
      .then(
        function(response) {
          console.log('code :' +response.status);
          if (response.status !== 200) {
            console.log('Looks like there was a problem. Status Code: ' +
              response.status);
            return;
          }

          // Examine the text in the response
          response.json().then(function(data) {
            // do some stuff
          });
        }
      )
      .catch(function(err) {
        console.log('Fetch Error :-S', err);
      });
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助;)

json http-status-code-302 microsoft-edge fetch-api

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

“作为附加组件测试”模式下出现“302 暂时移动”错误 (Telegram)

  1. 该电子表格包含项目 1,部署为具有以下权限的 Web 应用程序:Execute as: Me, Who has access: Anyone

网络应用程序

function doPost(e) {
  myLog('Received from Addon: ' + JSON.stringify(e));
  // console.log('parameters from caller ' + JSON.stringify(e));
  return ContentService.createTextOutput(JSON.stringify(e));
}
Run Code Online (Sandbox Code Playgroud)

Webhook aTelegram-bot 和此 Web 应用程序已设置。

  1. 我正在使用此电子表格来测试(作为附加组件)另一个项目 2。

添加在

function sendPost() {
  var sheetURL = SpreadsheetApp.getActiveSpreadsheet().getUrl();

  // var webAppUrl = "https://script.google.com/macros/s/#####/exec"; // 7: Part_1 - WebApp: My
  var webAppUrl = "https://script.google.com/macros/s/###/exec"; // 7: Part_1 - WebApp: Tester

  // var auth = ScriptApp.getOAuthToken();
  // var header = { 'Authorization': 'Bearer …
Run Code Online (Sandbox Code Playgroud)

web-applications add-on google-apps-script http-status-code-302 telegram-bot

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

Django,从php到Django

我有一个用Django完成的网站,以前用PHP和CodeIgniter完成.我已将网站移至Webfaction,更改了DNS和所有其他配置,但现在我的电子邮件中充满了以下错误:

Error (EXTERNAL IP): /index.php/main/leer/7497
Run Code Online (Sandbox Code Playgroud)

我不知道为什么Django应用程序正在寻找PHP应用程序中的页面,特别是因为PHP应用程序在另一个主机中.

django http-status-code-404 http-status-code-302

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

服务器返回302继续在Rails中创建

我有一个Backbone.js/Rails应用程序,我正在尝试通过Backbone创建一个新对象model.save().

服务器返回a 302 moved,但检查rails控制器,创建对象存在,我可以导航到索引,因此路由正确到位.

我已经尝试用常规的jquery .ajax函数替换backbone.js,并且两者都返回302,因为我最初认为错误是在主干中,但我认为这表明错误实际上是在rails中.

请求有效负载/参数非常简单

{"user_id":130,"message_text":"does this go 302","authenticity_token":"GxN8nPf5YwS2j2HhWZxWiKej3Y72Vb5IQZ98u5Nl2gs="}

骨干保存方法是

          var user_message = new Myapp.Models.UserMessage({
                user_id: user.id,
                message_text: $('input[name="message"]',this.el).val()
          });

         user_message.save({
                success: function(response) {
                new Message({message: response.message});
            },
                error: function() {
                new Error({ message: "adding message" });
            }
       });

ruby-on-rails http-status-code-302 backbone.js

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

backbone.sync获取所有响应错误状态代码

最后,我想捕获302错误并重定向到我的登录页面,但是现在xhr.status的状态代码为200.

这是我目前的代码:

parentSyncMethod = Backbone.sync
Backbone.sync = (method, model, options) ->
  old_error = options.old_error
  options.error = (xhr, text_status, error_thrown) ->
    if(xhr.status == 302)
      window.location.replace('http://localhost:8080/login')
    else
      old_error?(xhr, text_status, error_thrown)
  parentSyncMethod(method, model, options)
Run Code Online (Sandbox Code Playgroud)

基本上我认为问题是当前网页抛出了200错误,但抛出302的那个被包裹起来而没有传播到xhr.status.有没有办法从所有get,post,put等调用中获取所有状态代码响应?

javascript http-status-code-302 backbone.js

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

.htaccess将特定页面重定向到根目录

关于SO,有几个不同的问题,但是我没有找到能回答我具体问题的问题。

我想为我的htaccess添加一个重写规则,该规则会将所有流量

http://example.com/blog/its-a-sunny-day
Run Code Online (Sandbox Code Playgroud)

并重定向到

http://example.com
Run Code Online (Sandbox Code Playgroud)

理想情况下,此操作应通过302完成,因为稍后将进行更改。

.htaccess mod-rewrite http-status-code-302

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

WebRequest - 防止重定向

我正在使用a WebRequest来阅读HTML网站.服务器似乎正在重定向我的请求.

我的代码类似于以下内容:

    String URI = "http://www.foo.com/bar/index.html"
    WebRequest req = WebRequest.Create(URI);
    WebResponse resp = req.GetResponse();
    StreamReader sr = new StreamReader(resp.GetResponseStream());
    String returnedContent = sr.ReadToEnd();
Run Code Online (Sandbox Code Playgroud)

当我检查returnedContent它的内容包含来自重定向的内容,如"http://www.foo.com/FOO_BAR/index.html".我确信我请求的URL存在,因为它是收到的响应的一部分(作为IFrame).

有没有办法阻止WebResponse重定向并获取所请求的URL的内容?

UPDATE

设置req.AllowAutoRedirect = false导致302 Found状态代码,但不提供实际内容.

更多细节:我要求的网址是http://www.foo.com/bar/index.html我收到的内容http://www.foo.com/FOO_BAR/index.html

响应看起来类似于:

<body>
    <div>
        <iframe src="/foo/index.html"></iframe>
    </div>
</body>
Run Code Online (Sandbox Code Playgroud)

c# redirect httpwebrequest httpwebresponse http-status-code-302

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

强制路由到 HTTPS

我需要在实时服务器上设置 laravel 背包的帮助。

所以一开始我在加载资源时遇到了麻烦,因为它使用 http 作为图像和 css

http://example.com/images/http://example.com/css/

我可以使用我得到的代码解决这个问题

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> 
Run Code Online (Sandbox Code Playgroud)

资产已正确加载(它显示https://example.com/images/ ...当我检查时)

但不知何故,一些关键内容没有通过 https 加载,截图如下: 检查的元素用于文件管理器侧栏

随着错误

从源“ https://example.com ”访问位于“ http://example.com/admin/elfinder/connector ”的 XMLHttpRequest已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:重定向不允许用于预检请求。

这是错误的代码

  <!-- This file is used to store sidebar items, starting with Backpack\Base 0.9.0 -->
  <li>
    <a href="{{ backpack_url('dashboard') }}">
      <i class="fa fa-dashboard"></i>
      <span>{{ trans('backpack::base.dashboard') }}</span>
    </a>
  </li>
Run Code Online (Sandbox Code Playgroud)

还有一些内容没有更新为 https,例如一些 CSS(来自供应商/crud)、脚本、post 方法和徽标

我认为我可以将元标记复制粘贴到backpack_url,但我不知道它在哪里或它是如何工作的。

我对此很陌生,如有任何建议,我们将不胜感激

谢谢!

http-status-code-301 http-status-code-302 laravel laravel-blade laravel-backpack

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

如何在不使用Javascript的情况下重定向网页?

我的默认页面中有一些脚本,根据浏览器的语言将用户重定向到我网站的特定语言版本.我想添加一些重定向那些没有启用Javascript的用户的东西.

目前我有以下内容:

<noscript>
  <META HTTP-EQUIV=REFRESH CONTENT="1; URL=en/index.htm">.
</noscript>
Run Code Online (Sandbox Code Playgroud)

但我已经读过这个并不太明智,因为一些搜索引擎不屑一顾.我该怎么做并保持搜索引擎的快乐?

html javascript http-status-code-301 http-status-code-302

0
推荐指数
2
解决办法
1610
查看次数

Web服务跟随重定向错误 - 错误302(JAXWS)

这是我两天前问过的一个问题的链接,

如何使Web服务请求遵循重定向?

我正在使用jaxws库.

该服务形成URL,然后在内部创建HTTPURLConnection.如果我能抓住连接,我可以将followRedirect设置为true.

但没有得到相同的处理.它的紧急,任何帮助将受到高度赞赏.

redirect web-services jax-ws http-status-code-302

0
推荐指数
1
解决办法
4942
查看次数