出于某种原因,我无法使static_dir工作.在我的app.ymal中我有:
- url: /ui
static_dir: ui
- url: /dump
static_dir: dump
Run Code Online (Sandbox Code Playgroud)
从/ ui加载静态文件(即/ui/images/logo.png).但是当我尝试从/ dumo访问某些内容时,我得到:
INFO 2009-11-12 14:03:55,497 dev_appserver.py:3034] "GET /dump/kaxas.zip HTTP/1.1" 403 -
Run Code Online (Sandbox Code Playgroud)
如果我将zip文件的名称更改为其他名称,则会返回404错误.所以在某种程度上它找到了文件.
在服务器上,文件具有相同的所有者和组,以及相同的权限(chmod 755).
我在linux服务器上运行dev_appserver.
有任何想法吗?
..fredrik
python linux google-app-engine http-status-codes http-status-code-403
我使用以下PHP:
$xml = simplexml_load_file($request_url) or die("url not loading");
Run Code Online (Sandbox Code Playgroud)
我用:
$status = $xml->Response->Status->code;
Run Code Online (Sandbox Code Playgroud)
检查响应的状态.200 bening一切都好,继续.
但是,如果我收到403拒绝访问错误,我如何在PHP中捕获这个,以便我可以返回用户友好的警告?
我需要打开以下网址
$file = "http://en.wikipedia.org/w/api.php?action=parse&page=Kundapura&prop=text&format=xml";
$fp = fopen($file, "r");
Run Code Online (Sandbox Code Playgroud)
但我收到警告 http 请求失败/ 403 禁止
好吧,所以我在尝试加载时遇到了403错误 - 我安装了Zend 2,即使是通过youtube的指导,有人很幸运,它可以开箱即用.
我遵循了这个建议,但这没有用,因为LoadModule rewrite_module modules/mod_rewrite.so没有评论我的httpd.conf文件.
我尝试了这个,但添加Options +Indexes +FollowSymLinks +ExecCGI到我的vhosts.conf文件没有帮助.
我试图完全删除.htaccess文件.我试着评论文件的"XAMPP安全概念"部分httpd-xampp.conf.我试着非常好地问我,我试着大声咒骂 - 这两种策略都没有结果.
我正在运行Windows 8,我似乎无法弄清楚为什么我有权限错误.为了清楚起见,我在每次更改后重新启动Apache.当我从vhosts.conf文件中删除条目时,403已经消失,但这会导致该目录中的404.我已经包含了vhosts.conf文件中的相关代码.谢谢你的帮助!
NameVirtualHost *:80
<VirtualHost *:80>
ServerName zf2.localhost
DocumentRoot "C:/Users/Captain/Documents/zf2/public"
SetEnv APPLICATION_ENV "development"
<Directory C:/Users/Captain/Documents/zf2/public>
Options +Indexes +FollowSymLinks +ExecCGI
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
再次感谢.
更新1
错误日志是:
[Sun Mar 17 03:35:32.627159 2013] [authz_core:error] [pid 5492:tid 1764] [client ::1:50566] AH01630: client denied by server configuration: …Run Code Online (Sandbox Code Playgroud) 嗨,我使用宝石Nokogiri从红宝石工具箱中刮下宝石
Nokogiri::HTML(open("https://www.ruby-toolbox.com/categories/by_name"))
Run Code Online (Sandbox Code Playgroud)
但我得到错误:"403 Forbidden"
谁能告诉我为什么我会收到这个错误?
提前致谢
我想用他的网址下载一个文件。我将 AsyncTask 与 HttpURLConnection 一起使用,但是当我收到响应代码时,服务器返回错误 403。我在 doInBackground 中使用了 HttpURLConnection。
代码 :
@Override
protected String doInBackground(String... sUrl) {
InputStream input = null;
OutputStream output = null;
HttpURLConnection connection = null;
try {
ext = FilenameUtils.getExtension(sUrl[0]);
fileName = FilenameUtils.getBaseName(sUrl[0]);
Log.i("Brieg", "storage : /storage/emulated/0/" + fileName + "." + ext);
URL url = new URL(sUrl[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
return "Server returned HTTP " + connection.getResponseCode() + " " + connection.getResponseMessage();
}
int fileLength = connection.getContentLength();
input …Run Code Online (Sandbox Code Playgroud) android httpurlconnection http-status-code-403 android-asynctask
我在python中有一段代码可以生成http get请求.我可以成功地向http://google.com等网址发送请求并下载他们的网页.但我无法向http://stackoverflow.com提出请求.它显示HTTP 403禁止ERROR.但是我可以从浏览器访问stackoverflow.那么这个错误的原因是什么呢?
码:
import urllib2
c = urllib2.urlopen(' https://stackoverflow.com/ ')
contents = c.read()
print contents [0:50]
错误: HTTPError:HTTP错误403:禁止
我们在应用程序中使用 keycloak API。当我们尝试检索领域的客户端列表时,它会传递 403 禁止错误。非常感谢您的评论以避免此事。
String authServer = UriUtils.getOrigin(httpRequest.getRequestURL().toString()) + AUTH_CONTEXT_PATH;
String token = httpRequest.getHeader("Authorization").replaceAll("Bearer ", "");
String realmClientsUrl = authServer+"/admin/realms/testrealm/clients/"+getClientRepresentationId(authServer,realm,token);
ClientRequest request = getClientRequest(realmClientsUrl,token);
ClientResponse<String> response;
ClientRepresentation clientRepresentation = null;
try{
response = request.get(String.class);
validateResponse(response,"CLIENT_REPRESENTATION");
clientRepresentation = response.getEntity(ClientRepresentation.class);
return clientRepresentation;
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
通过的错误,
java.lang.Exception: ErrorStage:CLIENT_REPRESENTATION_ID,HTTP responseCode:403,StatusIno=Forbidden
Run Code Online (Sandbox Code Playgroud) 我真的第一次在网络(EC2)上加载 Laravel 应用程序。
我有一个运行最新 Laravel 5.6 的 Ubuntu 18.04 实例。我已经被困了几个小时试图解决 403 问题。我遵循了:
这些步骤(创建新组,向其中添加 ubuntu 和 www-data,设置组和所有者为读取、写入和执行)
这些步骤设置文件夹权限
...许多其他尝试/服务器重建...
所以刚才我把root中的所有文件和文件夹都设置为777来测试
$ find /home/ubuntu/projectname -type f -exec chmod 777 {} \;
$ find /home/ubuntu/projectname -type d -exec chmod 777 {} \;
Run Code Online (Sandbox Code Playgroud)
根据下面的建议,我也这样做了:
$ namei -l /home/ubuntu/projectname/public
f: /home/ubuntu/projectname/public
drwxr-xr-x root root /
drwxr-xr-x root root home
drwxr-xr-x ubuntu ubuntu ubuntu
drwxrwxrwx www-data www-data projectname
drwxrwxrwx www-data www-data public
$ sudo chmod -R 777 /home/ubuntu/projectname
$ ls -l
drwxrwxrwx 8 www-data …Run Code Online (Sandbox Code Playgroud) 我正在开发一个嵌入带有img标签的图像的 React 应用程序。并且某些图像未加载 403 错误:
但是,它可以在另一个 Chrome 标签上正常加载:
这是检查后的图像标签:
解决这个问题的方法是什么?