我有一个网站(来自godaddy 的域并托管在hostgator 中)。当我手动更新证书时,我可以将我的网站重定向到 https,但它总是从谷歌搜索转到 http。在线搜索后,我知道考虑到目标域的Strict-Transport-Security: max-age=15768000结果curl -i -L将满足我的需要,因为它会强制浏览器以 https 打开网站。但我对如何在我的网站上实现这一点感到困惑。
谁可以帮我这个事 ?
输入:https : //example.com => ssl ok 但是输入:www.example.com 和 example.com 是 http没有重定向https。(www 重定向到非 www)。
WordPress 地址 (URL) 和站点地址 (URL):https//example.com
/etc/nginx/conf.d/example.com.conf
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl on;
ssl_certificate /etc/nginx/ssl/cert_chain.crt;
#ssl_CACertificate_File /etc/nginx/ssl/example.com.ca-bundle;
ssl_certificate_key /etc/nginx/ssl/example.com.key;
access_log off;
# access_log /home/example.com/logs/access_log;
error_log off;
# error_log /home/example.com/logs/error.log;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
root /home/example.com/public_html;
include /etc/nginx/conf/ddos2.conf;
index index.php index.html index.htm;
server_name example.com;
Run Code Online (Sandbox Code Playgroud)
如何解决?对不起,我的英语不好,谢谢。
我想我所有的流量重定向从http到https自动。如何将 301 重定向到我的所有域和子域?
这是 NGINX 配置文件
upstream app_server {
server unix:/run/DigitalOceanOneClick/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name sprintsocial.io app.sprintsocial.io admin.sprintsocial.io;
# return 301 https://$server_name$request_uri;
}
server {
#listen 80;
listen 443;
root /home/rails/sprintsocial/public;
#server_name _;
server_name sprintsocial.io app.sprintsocial.io admin.sprintsocial.io;
ssl on;
ssl_certificate /home/sprintsocial.io.chained.crt;
ssl_certificate_key /home/sprintsocial.io.key;
index index.htm index.html;
# return 301 https://$server_name$request_uri;
# rewrite ^/(.*) https://app.sprintsocial.io/$1 permanent;
# rewrite ^/(.*) https://admin.sprintsocial.io/$1 permanent;
location / {
try_files $uri/index.html $uri.html $uri @app;
} …Run Code Online (Sandbox Code Playgroud) 我正在使用 Flask 构建一个网络应用程序。目前我使用 Gunicorn 为应用程序提供服务,使用 nginx 作为反向代理。Chrome 开发工具抱怨一个端点不是 HTTPS:
混合内容:“ https://example.com:88/ ”上的页面已通过 HTTPS 加载,但请求了不安全的 XMLHttpRequest 端点“ http://example.com/geo2?coordinates= ”。此请求已被阻止;内容必须通过 HTTPS 提供。
在 app.py 中,我为 Flask 设置了 HTTPS:
context = ('ssl/server.crt', 'ssl/server.key')
app.run(host='0.0.0.0', port=443, ssl_context=context, threaded=True, debug=True)
Run Code Online (Sandbox Code Playgroud)
我正在执行 gunicorn :
gunicorn --bind 0.0.0.0:8282 app:app
Run Code Online (Sandbox Code Playgroud)
我的 nginx 配置(为简洁起见省略了所有 SSL 设置):
server {
listen 88 ssl;
server_name example.com www.example.com;
root /var/www/app/;
index index.html;
location / {
proxy_pass http://192.168.1.5:8282/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $server_name;
}
}
Run Code Online (Sandbox Code Playgroud)
我注意到我只看到一个端点 /geo2 的错误。我的应用程序设置为在 /geo 收到 POST …
我在 Azure 上部署了我的 nodejs https 服务器
https.createServer(options, app).listen(8080, ()=>{console.log("listening on 8080")});
从上面的代码片段可以看出,它正在侦听端口 8080
我应该如何访问 Azure 网站上的服务器?
https://myapp.azurewebsites.net/ 或 https://myapp.azurewebsites.net:8080/
我刚刚使用我从 GoDaddy 购买的域为我的 Google App Engine 设置了一个自定义域。然后我将域名服务器转移到云 DNS 并将云文档建议的 DNS 记录插入到云 DNS 记录集中,并且它工作正常。
但是,问题是我使用自定义域时,并没有默认为网站的HTTPS版本,我必须手动输入HTTPS(即我不能直接去example.com,我必须去https://example.com).
我在这里做错了什么?
谢谢!
当我尝试连接到我的本地主机时,出现 [SSL: WRONG_VERSION_NUMBER] 错误。我默认使用“8080”端口。以前,我收到 ProxyError,然后我将 url 从“http”更改为“https”,现在我收到 SSLError。我检查了一些解决方案,提示更改端口号。它与端口号或其他什么有关吗?
视图.py:
endpoint = 'https://****:8080/MyApp/services/DBConnection/callLoginProcedure'
def index(request):
post = request.POST
if request.POST.get('login_button'):
qd = QueryDict(mutable=True)
qd.update(
inputPhoneNumber=request.POST.get('phone_num'),
inputPassword=request.POST.get('password')
)
response = requests.post('{}?{}'.format(endpoint, qd.urlencode()), verify=False)
result = response.json()
messages.info(request, result)
return render(request, 'login/index.html')
Run Code Online (Sandbox Code Playgroud)
错误如下
堆栈跟踪:
Django Version: 2.2.3
Python Version: 3.7.3
Installed Applications:
['login',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware']
Traceback:
File "C:\Program Files\Python37\lib\site-packages\urllib3\connectionpool.py" in urlopen
603. chunked=chunked)
File "C:\Program Files\Python37\lib\site-packages\urllib3\connectionpool.py" in _make_request
344. self._validate_conn(conn)
File "C:\Program …Run Code Online (Sandbox Code Playgroud) 我正在尝试为 https 网站推送制作一个简单的解析器,因此尝试遵循http://rosettacode.org/wiki/HTTP#Ada 中的示例,只需更改网站的地址即可。
所以我试过了
with Ada.Text_IO; use Ada.Text_IO;
with AWS.Client;
with AWS.Response;
procedure Main_Other is
begin
Put_Line (AWS.Response.Message_Body
(AWS.Client.Get
(URL => "https://google.com")));
end Main_Other;
Run Code Online (Sandbox Code Playgroud)
但我有一个例外
引发的 PROGRAM_ERROR :aws-client.adb:398 finalize/adjust 引发的异常 [2020-04-02 10:41:20] 进程以状态 1 退出,经过时间:00.80s
那么,关于如何解决这个问题的任何想法?
我想解析网站中某些表的当前状态,类似于在 Python 中制作类似的东西
import pandas as pd
def retrieve_json(json_url):
return pd.read_json(json_url)
Run Code Online (Sandbox Code Playgroud)
我想以最简单的方式编写此解决方案,甚至最好不要依赖 AWS。
请,谢谢。
我使用这个拓扑模型来解析 Json 数据。接收汉字时数据出现乱码。
我曾尝试添加 utf8.decode 之类的
List<Client> clientFromJson(String str) => List<Client>.from(json.decode(utf8.decode(str)).map((x) => Client.fromJson(x)));
Run Code Online (Sandbox Code Playgroud)
但是 IDE 告诉我“无法将参数类型 'String' 分配给参数类型 'List< int >'”。
我应该怎么做才能在模型中添加 utf8 解码器?
///topology.dart
// To parse this JSON data, do
//
// final client = clientFromJson(jsonString);
// final topology = topologyFromJson(jsonString);
import 'dart:convert';
List<Client> clientFromJson(String str) => List<Client>.from(json.decode(str).map((x) => Client.fromJson(x)));
String clientToJson(List<Client> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
List<Topology> topologyFromJson(String str) => List<Topology>.from(json.decode(str).map((x) => Topology.fromJson(x)));
String topologyToJson(List<Topology> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class Topology {
String location;
String mode; …Run Code Online (Sandbox Code Playgroud) 我遵循了有关如何在 android 模拟器上添加 fiddler 证书的说明,使用 nox 和 memu 模拟器,以及运行棉花糖的 android 手机,当我打开网站时,我将 WiFi 代理设置为通过本地网络指向我的 PC使用 Web 浏览器,一切正常,我收到警告,我选择继续,并且使用 fiddler 成功隧道和解密连接。
但是,当我尝试使用其他应用程序时,连接失败!我看到隧道连接,然后连接失败。我敢打赌,这是由于 HTTPS 证书无效,所以我的问题是,有没有办法让我将 fiddler 安装到受信任的机构,以便在没有警告的情况下连接到它?所以我终于可以调试进出这些应用程序的 HTTPS 流量了。
我在 SO 上发现了类似的问题,但没有一个与我的完全相同,也没有正确的答案,所以我不确定这个问题实际上是否符合重复的条件。
谢谢