我需要能够将单个页面从标准http重定向到https.例如,我想从http://domain.com/quote.php转到https://domain.com/quote.php.
到目前为止,我在.htaccess文件中使用此代码,并且它正在用于初始重定向.
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^quote.php https://domain.com/quote.php [R=301,L]
Run Code Online (Sandbox Code Playgroud)
我的问题是,一旦我访问了quote.php页面并重定向到https版本,我导航的所有其他网站页面继续使用https协议.这是一个潜在的重复内容问题,因为我现在可以通过http和https访问相同的内容.
所以我想做的是,能够做上面的重定向,然后以某种方式对除除quote.php之外的所有页面反向做同样的事情.因此,如果您尝试通过https访问它们,它将重定向到默认的http版本.
我在整个站点中使用相对URL,因此我不能简单地在https/http前缀中进行硬编码.如果可能的话,我需要能够通过.htacess这样做.
任何帮助是极大的赞赏.
当使用fb.UI时,https托管的iframe页面会给出一个正确的模态对话框,但是同一个页面通过http给出一个弹出窗口
这是我的代码,主要来自facebook对话框帮助页面:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<p>oh, hello.</p>
<div id='fb-root'></div>
<script src='//connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
<script>
FB.init({appId: "myappid", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'http://www.facebook.com/testapp/app_myappid/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs',
caption: 'Reference Documentation',
description: 'Using Dialogs to interact with users.',
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script> …Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个使用SSL连接的Web应用程序.所以我做了一些研究,发现我可以使用RequireHttpsAttribute类来实现我所需要的.事情是,当我使用它时,应用程序的执行导致310错误(重定向太多).我甚至构建了一个自定义类来处理从http到https的切换.但这也会导致错误.
我的类处理te协议开关:
Public Class RequireSSLAttribute
Inherits ActionFilterAttribute
Public Property IsRequired() As Boolean
Public Overrides Sub OnActionExecuting(filterContext As ActionExecutingContext)
If Me.IsRequired AndAlso filterContext.HttpContext.Request.Url.Scheme <> "https" Then
filterContext.HttpContext.Response.Redirect(filterContext.HttpContext.Request.Url.OriginalString.Replace("http:", "https:").Remove(filterContext.HttpContext.Request.Url.OriginalString.LastIndexOf(":") + 1), True)
filterContext.Result = New HttpUnauthorizedResult
End If
End Sub
Public Sub New()
IsRequired = True
End Sub
End Class
Run Code Online (Sandbox Code Playgroud) 我没有在我的域上配置HTTPS,所以我不确定从这个警告提示开始,我只能在我的iPhone和iPad上使用iOS Safari.我从未在使用Mac Safari,Chrome,FF或IE的桌面上获得此功能.
有人可以将我指向我的ubuntu/apache EC2服务器上的文件或我的域提供商GoDaddy站点上的某个文件,该文件用于验证证书.
我正在使用GAE + Python创建一个需要向客户端发送敏感数据实时更新的应用程序,我想知道App Engine Channel API是否安全.使用HTTPS是否足够或渠道是否需要自己的安全协议?
此外,App Engine Channel API的底层实现是什么?Websockets,SSE?看起来它实际上只提供从服务器到客户端通过通道的单向通信,然后客户端使用标准HTTP请求与服务器通信.
我使用Visual Studio 2008 ...,并创建了一个ASP.NET网站。在此网站项目中,我有一个Web服务文件.asmx。通过HTTP调用此服务就可以了。但是现在有一个要求,它必须通过SSL / HTTPS来调用。
当我通过HTTP浏览到URL时,.asmx和WSDL会很好地显示出来。但是,只要我输入HTTPS,浏览器就会显示消息“ Internet Explorer无法显示该网页”
我们在带有IIS的Windows 2003服务器上运行此站点。
如果可能的话,我只想通过HTTPS调用此服务...,并通过HTTP保留此项目中的其余页面。如果那非常困难,我仍然可以为此服务创建一个新项目...但是我仍然不知道如何允许通过HTTPS访问它。
在此先感谢您的帮助!
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
<WebService(Namespace:="http://services.vm.vmc/InstantAccount/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class MyWebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function doSomething(ByVal p_String As String) As String
Return "Test"
End Function
End Class
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用NSURLConnection的委托方法.目前尚未调用以下方法:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
//I also want to be able to use self-signed https urls
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
//I also want to be able to use self-signed https urls
Run Code Online (Sandbox Code Playgroud)
我目前正在使用同步调用,但异步似乎更好,因为在我完成代码库后,我将把它实现到iPhone应用程序中,我不能让我的ui冻结.
用以下方法responseData = [NSMutableData dataWithData:[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]];
我得到了我需要的数据但是使用异步我似乎必须使用委托方法来获取数据.我尝试使用添加委托@interface myClass : NSObject<NSURLConnectionDelegate>
我正在调用我的方法如下:
-(void)grabData{
NSArray* array = [NSArray arrayWithObjects:@"auth.login",@"user",@"pass", nil];
NSData* packed_array = [array messagePack];
NSURL* url = [NSURL URLWithString:@"https://192.168.1.115:3790/"];
NSMutableURLRequest* request = [[[NSMutableURLRequest alloc]initWithURL:url]retain];
[request setHTTPMethod:@"POST"]; …Run Code Online (Sandbox Code Playgroud) 如何配置和测试SSLSessionCacheTimeout值?如何与http保持活动超时不同?
谢谢,Gayathri
我设置了密码缓存,但奇怪之处在于我认为我已经这样做了.从电子邮件到github,似乎他们改变了一些东西:
你好Thufir,
您所看到的是,默认情况下,所有新创建的repos现在都使用Smart HTTP而不是SSH.我们在这里有一篇帮助文章,解释了如何在此处进行更改:https: //help.github.com/articles/why-is-git-always-asking-for-my-password
我们在这里也有一篇关于它的博客文章:https: //github.com/blog/1104-credential-caching-for-wrist-friendly-git-usage
我看到的奇怪之处在于我似乎回想起前一段时间的那些确切方向,用于缓存密码.
此外,是否有一个更好的方法,或许有一个公钥?我不太确定我的密码缓存在哪里,但我知道这不是一个好主意.(我在Linux上,所以不能在电子邮件中使用建议的.exe.)
我正在尝试在我的Node.js服务器(Expressjs框架)上实现HTTPS.我有我签名的证书和密钥,以及用于测试/开发的自签名证书/密钥:
if(process.env.NODE_ENV == 'production'){
var app = module.exports = express.createServer({
key: fs.readFileSync('./ssl/nopass_server.key'),
cert: fs.readFileSync('./ssl/server.crt')
});
} else {
var app = module.exports = express.createServer({
key: fs.readFileSync('./ssl/self_signed/nopass_server.key'),
cert: fs.readFileSync('./ssl/self_signed/server.crt')
});
}
Run Code Online (Sandbox Code Playgroud)
我还在Heroku上设置了SSL端点.一切正常localhost,Endpoint似乎工作正常,但是当我在生产中运行应用程序(在Heroku上)时,我得到一个H13应用程序错误.有趣的是(或者不是)如果我告诉express创建一个HTTP服务器:var app = module.exports = express.createServer()它可以工作,但Chrome会抱怨the page at https://mydomain.com ran insecure content from http://mydomain.com.
我不能/不应该在快递中为生产创建HTTPS服务器吗?如果我应该,有什么额外的东西我需要让它在Heroku上工作(例如,我相信它设置正确的端口var port = process.env.PORT)?如果没有,如果没有运行https服务器,我怎么能提供"安全"内容,以便浏览器不会抱怨?
我正在使用以下内容来处理任何非https请求:
app.get('*',function(req,res,next){
if(req.headers['x-forwarded-proto'] != 'https'){
res.redirect('https://mydomain.com'+req.url);
} else next();
});
Run Code Online (Sandbox Code Playgroud)
目前它位于我的其他路线上方,这可能是问题/应该在其他地方吗?
我对https的一般经验非常有限,所以我可能会遗漏一些明显的东西.
https ×10
ssl ×4
ios ×2
.htaccess ×1
.net ×1
asp.net-mvc ×1
channel-api ×1
express ×1
facebook ×1
git ×1
github ×1
heroku ×1
iis ×1
java ×1
javascript ×1
node.js ×1
objective-c ×1
python ×1
redirect ×1
security ×1
ssh ×1
vb.net ×1
web-services ×1