配置 nginx 以解决 nopCommerce 中的标头问题

发布于 2025-01-15 02:55:47 字数 503 浏览 2 评论 0原文

我有一个运行 docker 的 Ubuntu VM,带有 nopCommerce 4.30 和 nginx。我想添加一个身份验证插件,但我发现存在一个已知问题 https:// github.com/nopSolutions/nopCommerce/issues/5584 阻止这些插件在反向代理后面工作。我无法更新到 4.50(已修复问题的版本)或对当前 4.30 映像进行更改,除了更改 web.config 和 appsettings.json 等配置之外。

我需要一种方法来解决此 return_url 地址问题或某种方法来解决它。

我想尝试的想法之一是使用 nginx 将请求中的 http 替换为 https,但我不知道如何做到这一点,也不知道是否有某种检查可以阻止这种情况。

更新:nginx https 替换不起作用,似乎内置了某种防篡改功能

I have an Ubuntu VM running docker, with nopCommerce 4.30 and nginx. I wanted to add an authentication plugin, but I found out that there is a known issue https://github.com/nopSolutions/nopCommerce/issues/5584 that prevents these plugins from working while behind a reverse proxy. I am not able to update to 4.50 (version where the issue is fixed) or make changes to the current 4.30 image, other that changing configs like web.config and appsettings.json.

I need a way to fix this return_url address issue or some way to work around it.

One of the ideas I wanted to try is using nginx to replace the http with https in the request, but I do not know how to do it or if there is some sort of check that would prevent that.

Update: The nginx https replacement did not work, seems there is some kind of anti-tampering built in

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

居里长安 2025-01-22 02:55:47

从 HttpsRequirementAttribute 操作过滤器中,您可以看到 nopCommerce 如何处理 http==>https。

请前往以下地点
src==>Presentation==>Nop.Web.Framework==>Mvc==>Filters==>HttpsRequirementAttribute.cs

在这里您将看到 HTTP 到 HTTPS 的切换情况。我们注释掉这段代码并从负载均衡器和网络处理它。 http 到 https 的配置。

同样在 appsetting.json 中,我们更改了如下所示的

“Hosting”:{
“UseHttpClusterHttps”:假,
“UseHttpXForwardedProto”:假,
“ForwardedHttpHeader”:“”
},

希望这些信息能够帮助您更深入地了解这个问题。

From the HttpsRequirementAttribute action filter, you can see how nopCommerce handle the http==>https.

Please go to the bellow location
src==>Presentation==>Nop.Web.Framework==>Mvc==>Filters==>HttpsRequirementAttribute.cs

here you will see the switch case for HTTP to HTTPS. We comment out this code and handle it from the load balancer and web. config for http to https.

Also at the appsetting.json, we change something like bellow

"Hosting": {
"UseHttpClusterHttps": false,
"UseHttpXForwardedProto": false,
"ForwardedHttpHeader": ""
},

Hope this information will help you to deep down more about the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文