Nopcommerce: Can't login or register (ERR_TOO_MANY_REDIRECTS)

Created on 1 May 2020  路  10Comments  路  Source: nopSolutions/nopCommerce

nopCommerce version: 4.3

Steps to reproduce the problem:

  • Download NopCommerce 4.3 with code.
  • UnZip code to HD
  • Run in VS Version 16.6.0 Preview 2.1
  • Install database in SQL Server V18.5
  • After NopCommerce started I can't login or Register
    Error Message: Redirected many times! ERR_TOO_MANY_REDIRECTS
  • I tried http and https.
bug

All 10 comments

I tried to remove this line:
[HttpsRequirement]
From:
Presentation/Nop.Web/Controllers/CustomerController line: 384

and it worked!

I have same problem. What is best solution for that to handle on localhost ?

I have it setup in both Visual Studio and on IIS and I could not login in either. When I ran the setup on IIS the default settings are not created for SSL (See Image 1).
StoreSetup1
I had to manually set the values then restart the webserver. Then I can login (See Image 2)
StoreSetup2
I also note the securitysettings.forcesslforallpages Setting is no longer used ?

I am using Cloudflare SSL, you need add one line in web.config

<httpProtocol> <customHeaders> section to set Use_HTTP_X_FORWARDED_PROTO to true.

check here https://www.nopcommerce.com/en/boards/topic/48285/err_too_many_redirects
or here https://www.nopcommerce.com/en/boards/topic/42111/cloudflare-flexible-ssl-and-nopcommerce-problem/page/2

`For those who are still struggling with Cloudflare Flexible SSL, this is how we solved the issue in nop 4.20:

  1. Set UseHttpXForwardedProto = true in Nop.Web/appsettings.json (Cloudflare setups X-Forwarded-Proto header to determine if request is secured. See more https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-Cloudflare-handle-HTTP-Request-headers- ).
  2. Ensure "Always Use HTTPS" setting is enabled in Cloudflare.
  3. Ensure nopCommerce Store "URL" has https schema.
  4. Ensure nopCommerce Store "SSL Enabled" setting is set to true.
  5. Ensure nopCommerce "Force SSL for all pages" is enabled.
    `

The problem is here:
RedirectRequest(filterContext, _storeContext.CurrentStore.SslEnabled);
If we change this line to:
RedirectRequest(filterContext, !_storeContext.CurrentStore.SslEnabled);
It worked!

Nop.Web.Framework.Mvc.Filters.HttpsRequirementAttribute.HttpsRequirementFilter.OnAuthorization(AuthorizationFilterContext filterContext)

This value from where? _storeContext.CurrentStore.SslEnabled

SslEnabled is false so app redirect you to http with https port, but in VB localhost http port and https port is different.

I also had this problem, and was able to resolve this via updating the database and set the following:

Url -> https://[my site url]
Hosts -> [changed this to my site host]
SslEnabled -> 1

The question is: How the normal user can update the store data if he can't login.

Closed #4641

The question is: How the normal user can update the store data if he can't login.

Unfortunately, the only way to make corrections to the configuration when there is no access to the administration area is to directly edit the database.

I have it setup in both Visual Studio and on IIS and I could not login in either. When I ran the setup on IIS the default settings are not created for SSL (See Image 1).
StoreSetup1
I had to manually set the values then restart the webserver. Then I can login (See Image 2)
StoreSetup2
I also note the securitysettings.forcesslforallpages Setting is no longer used ?

it worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndreiMaz picture AndreiMaz  路  6Comments

mrnams picture mrnams  路  3Comments

AndreiMaz picture AndreiMaz  路  3Comments

JohnsonJohnsonYuan picture JohnsonJohnsonYuan  路  5Comments

mariannk picture mariannk  路  4Comments