redirect - 我的资源是在 https 而不是 http 下加载的
问题描述
我在 Raspberry Pi 上使用 Asp.Net Core 并使用 NGINX 作为我的服务器。
在我看来:我有这些(等):
<script src="~/js/Messanger.js" asp-append-version="true"></script>
但它被服务(并且未能服务)为
https://192.168.0.12/js/Messanger.js
我尝试使用完整路径(因为我知道 IP)
<script src="http://192.168.0.12/js/Messanger.js" asp-append-version="true"></script>
我的打开页面被用作 http。
我在我的项目设置中禁用了 SSL。
我已经注释掉了:app.UseHttpsRedirection(); 在 startup.cs 中并已更改:
"applicationUrl": "https://localhost:5001;http://localhost:5000"
至
"applicationUrl": " http://localhost:5001;http://localhost:5000 "
在 LaunchSettings.json 中(虽然我知道这没有在发布中部署)。
在我的 Rpi 上 nginx 的默认配置中,我有:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location /MyServer/ {
proxy_pass http://localhost:5000/;
proxy_http_version 1.1;
proxy_set_header Connection keep-alive;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto http;
proxy_set_header X-Forwarded-Path /MyPath;
}
解决方案
推荐阅读
- python - AttributeError:“列表”对象没有属性“相似性”
- python - 为什么 pd.to_timedelta 在提供 int 系列时会失败?
- string - YAML 多行符号在 Jekyll 数据文件中不起作用
- python - 我无法弄清楚以下代码是如何工作的?
- java - 我该如何解决这个明显的合并错误
- node.js - 如何在 NodeJS 上修改数组
- r - 从 R 中的列表访问列表
- python - Pyspark - 将字符串转换为时间戳 - 获取空值
- javascript - 如何使用 setAttribute 将回调中的值添加到新元素中?
- excel - 考虑一列的多个值的Excel逻辑测试