我对https://api.scarif.dev/auth的 Guzzle POST 请求返回 404,而该页面是通过 Postman、浏览器或 JavaScript 存在的。它应该返回 200 和 401 消息,但 Guzzle 返回 404。在 POST 和 GET 模式下都是如此。
我尝试了多种客户端设置,包括不同的标头和禁用 SSL 验证,但没有成功。现在我已经复制了使其在邮递员中工作的完全相同的标头,但仍然没有成功。
我一直在通过谷歌和 stackoverflow 搜索,但找不到解决我的问题的答案。
PHP 中的请求:
<?php
$client = new Client([
'header' => [
'Accept' => 'application/json',
'Content-Type' => 'application/x-www-form-urlencoded'
],
'verify' => false
]);
$response = $client->request('POST', 'https://api.scarif.dev/auth', [
'form_params' => []
]);
echo $response->getBody()->getContents();
?>
Run Code Online (Sandbox Code Playgroud)
预期结果:
{
"detail": "https://login.scarif.dev",
"status": 401,
"title": "Unauthorized",
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}
Run Code Online (Sandbox Code Playgroud)
实际结果:
致命错误:未捕获的 GuzzleHttp\Exception\ClientException:客户端错误:
POST https://api.scarif.dev/auth导致404 Not Found响应:404 …
我正在尝试为我的 Blazor 项目设置一个 Github Pages 网站。即使有了一个全新的 blazor 项目,我也没有成功。按照人们就这个问题给出的说明,我在未经修改的新项目中不断遇到 404 错误。
您可以在https://billybillyjim.github.io找到我当前的尝试,重现位于https://github.com/billybillyjim/billybillyjim.github.io
我目前的流程是这样的:
在 Visual Studio 2019 预览版 (3.0.100-preview6-012264) 中创建全新的客户端 Blazor 页面。
转到 Github Pages 并创建一个名为 billybillyjim.github.io 的存储库
使用桌面 Github 应用程序将存储库克隆到本地文件夹。
使用 VS2019 的“生成”菜单中的“发布”选项,我选择一个文件夹配置文件。
成功构建后,我将创建的文件从已发布的文件夹移动到存储库文件夹。
我提交并推送到 github。
我添加了一个 .nojekyll 文件,并将 SPA javascript 脚本添加到新的 404.html 和 index.html 中。
尝试加载页面时出现 404。“无法加载资源:服务器以 404 () 状态响应” 此错误适用于每个 dll 文件。
我尝试过的事情:
将所有内容放入一个文件夹中,更改index.html中的基本href,并将SPA脚本segmentCount设置为1。
删除下划线并更新索引和两个 blazor.js 文件中的文件引用。
将 index.html 中的 href 更改为存储库名称,如此处说明末尾所述。
我将我的设置与https://github.com/blazor-demo/blazor-demo.github.io的示例页面进行了比较。io 的设置与我的非常相似,但它已有一年了,似乎使用了非常不同的设置一组 dll 和不同的 blazor.js。
我对网络开发完全陌生,所以我认为我很可能完全误解了一些简单的事情。
如何在React(使用react-router-dom)中返回404状态代码?
<Route component={NotFoundPage} path="*" />
Run Code Online (Sandbox Code Playgroud)
我得到的答案可以返回404页面,但不能返回http状态代码。有什么办法解决这个问题吗?
想要创建一个“标签页面”,其中包含带有特定标签的所有帖子。我将其添加到网站标题中,但始终收到 404 错误。看起来标签页面根本没有构建?
404错误页面: https://tiffanychenster.github.io/personal-blog/tag/reviews/
仓库: https: //github.com/tiffanychenster/personal-blog
很困惑为什么它可以在本地运行,但不能在 Github 页面上运行。我以为这可能是我的导航链接的错误,但经常用 header.html 搞乱,却一无所获。任何有关在远程服务器上创建标签页面的帮助将不胜感激
我正在将教程中的 auth0 集成到我自己的应用程序中,并且遇到了 auth0 日志中反映的一些身份验证问题。
点击我的反应登录按钮时会发生这种情况:
import React from "react";
import { useAuth0 } from "@auth0/auth0-react";
import '../components/App.css'
const LoginButton = () => {
const { loginWithRedirect } = useAuth0();
return <button class="btn btn-primary" onClick={() => loginWithRedirect()}>Log In</button>;
};
export default LoginButton;
Run Code Online (Sandbox Code Playgroud)
但是,在 Auth0 应用程序日志中,我看到我已成功通过身份验证,并且还获得Failed Exchange了Successful Login和Warning During Login。
Warning During Login这是日志的文本Warning During Login:
您正在使用 Auth0 开发密钥,该密钥仅用于开发和测试。应使用您自己的开发密钥配置此连接 (google-oauth2),以使同意页面能够显示您的徽标而不是 Auth0,并为此连接启用 SSO。不建议在生产环境中使用 AUTH0 开发密钥。要了解有关开发密钥的更多信息,请参阅 https://auth0.com/docs/connections/social/devkeys。
按照Auth0 网站上的说明已修复此问题。本质上: …
我有以下路由配置:
<Router>
<NotFound default />
<ResourcesContainer path="/resources" />
<ResourceContainer path="/resources/:id" />
...
</Router>
Run Code Online (Sandbox Code Playgroud)
这会捕获任何未处理的路由,并<NotFound />在未找到的 URL 处呈现组件,因此如果我键入example.com/blah,我会看到<NotFound />呈现的组件,并且在地址栏中会看到example.com/blah。我还在页面上使用此 URL 来显示消息:
找不到页面“example/blah”。
到目前为止,一切都很好。但是我还需要从/resources/*路由内部处理 404。我的<ResourcesContainer/>组件使用路径的最后一部分来访问具有该 id 的资源的 GraphQL API。如果 API 返回告诉客户端资源不存在,我想模仿上面概述的行为。但是,我没有可以导航到的页面。我可以复制该<NotFound />路线并给它一个明确path的/404,然后导航到该路线。然而,URL 将是/404,而不是resources/*未找到的原始路径。
以下解决了部分问题,给了我一个重定向 ot 的页面,但意味着/404在所有情况下 URL 都会被重写:
<Router>
<ResourcesContainer path="/resources" />
<ResourceContainer path="/resources/:id" />
<NotFound path="/404" />
<Redirect noThrow from="*" to="/404" />
...
</Router>
Run Code Online (Sandbox Code Playgroud)
我该如何设置才能在不丢失原始 …
大家好,我在桌面上打开我的网站时遇到问题。在我创建应用程序并执行所有代码的笔记本电脑上,我的 React 应用程序工作正常并更新,但是在其他计算机上,只有我的组件/元素加载,而我的 axios 请求正在返回(404 连接拒绝错误)。有什么提示或修复吗?PS 这是我第一次尝试将应用程序构建部署到网络服务器(digitalocean/NGINX)。
NGINX 配置文件
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/epenn92reactapp.space/html/among-us-reactapp3/client/buil>
index index.html index.htm index.nginx-debian.html;
server_name epenn92reactapp.space www.epenn92reactapp.space;
error_page 405 =200 $uri;
error_page 404 /index.html;
location ^~ /assets/ {
gzip_static on;
expires 12h;
add_header Cache-Control public;
}
location /v1/api {
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://64.227.5.159:8080;
try_files $uri /index.html;
}
listen [::]:443 ssl ipv6only=on; …Run Code Online (Sandbox Code Playgroud) 我已经在这里和其他地方搜索过以找出问题所在,但找不到好的解决方案。我创建了一个针对 .NET6 的新 .NET Core Web 应用程序。我在没有身份验证且没有 Docker 支持的情况下创建了该项目。我希望新的应用程序能够使用默认登录页面开箱即用,但我却收到网页未找到错误。它没有点击 Razor 页面的 Index OnGet 方法。这是一个简单的应用程序,我只想自己运行,所以我不会使用 MVC,只使用 Razor。有人在 .NET 6 中解决了这个问题吗?这是响应、程序类和启动设置:
程序.cs
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
Run Code Online (Sandbox Code Playgroud)
启动设置
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true, …Run Code Online (Sandbox Code Playgroud) 我是vite的新手,我安装了,编写了一些代码,执行了npm run dev和npm run build。
一切都很顺利,直到上传到我的服务器。
索引.html:
<script type="module" crossorigin src="/assets/index.a673cca3.js"></script>
Run Code Online (Sandbox Code Playgroud)
从实时服务器运行时,我收到这些错误
Failed to load resource: net::ERR_FAILED index.4293b7ae.css:1
Failed to load resource: net::ERR_FILE_NOT_FOUND index.a673cca3.js
Run Code Online (Sandbox Code Playgroud)
文件名是正确的,并且它们位于应该的位置。
是什么赋予了?
我正在使用Django 1.1.1稳定版.何时DEBUG设置为True Django flatpages正常工作; 当DEBUG是False每一个简单页面我尝试访问引发自定义404错误(我的错误模板,显然正常工作).
在互联网上搜索建议我创建404和500模板.
我已添加到FlatpageFallBackMiddlewaremiddleware_classes并将flatpages添加到已安装的应用程序中.我有什么想法可以让flatpages工作吗?
reactjs ×4
c# ×2
github-pages ×2
.net-6.0 ×1
auth0 ×1
blazor ×1
client-side ×1
django ×1
guzzle ×1
http ×1
javascript ×1
jekyll ×1
nginx ×1
php ×1
razor-pages ×1
reach-router ×1
routes ×1
vite ×1
webserver ×1