Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] New Page in Sub-Site Causes 404 Error by Redirecting to Root Site #4339

Closed
tvatavuk opened this issue Jun 13, 2024 · 1 comment
Closed

Comments

@tvatavuk
Copy link
Contributor

Oqtane Info

Version - 5.1.2 (and older 5.1.x versions)
Render Mode - Static (issue also occurs in Interactive mode)
Interactivity - Server (issue also occurs in Client interactivity)
Database - SQL Server

Describe the bug

After creating a new page within a sub-site, the browser navigates to an unexpected location within the root site. The new page is created in the sub-site as expected, but the browser either:

  • Displays a 404 error page within the root site,
  • Shows a page with the same name from the root site (if one exists),
  • Renders some other strange issue on a page from the root site while keeping the route in the browser within the sub-site. This issue occurs when a new page is created using the Page Management feature from the admin dashboard.

Expected Behavior

The browser should either:

  • navigate to the correct location of the newly created page within the sub-site, or
  • navigate back to /sub-site/admin/pages if the new page is created from the Page Management feature in the admin dashboard.

Steps To Reproduce

  1. Install a new Oqtane 5.1.2 release website on IIS from the release zip (example URL: https://oqtane-poc324.oqtane.me/) and log in as host.
  2. Create a new page named 'p1' in the root site. This works as expected (URL: https://oqtane-poc324.oqtane.me/p1).
    image
  3. Create a sub-site named 'is01' (URL: https://oqtane-poc324.oqtane.me/is01). This works as expected.
  4. Create a new page named 'pg1' in the sub-site 'is01'.
    image
  5. Observe that the browser navigates to a 404 page within the root site (URL: https://oqtane-poc324.oqtane.me/404).
    image.

Here is other example, when new page 'pgg1' created from interactive web assembly sub-site 'ic01'.
image
image

Anything else?

from log


info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://oqtane-poc324.oqtane.me/api/Page?siteid=3 - 200 - application/json;+charset=utf-8 6.4846ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST https://oqtane-poc324.oqtane.me/is01/api/Page - application/json;+charset=utf-8 -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Oqtane.Controllers.PageController.Post (Oqtane.Server)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[102]
      Route matched with {action = "Post", controller = "Page", page = ""}. Executing controller action with signature Oqtane.Models.Page Post(Oqtane.Models.Page) on controller Oqtane.Controllers.PageController (Oqtane.Server).
info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
      Executing ObjectResult, writing value of type 'Oqtane.Models.Page'.
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[105]
      Executed action Oqtane.Controllers.PageController.Post (Oqtane.Server) in 17.8297ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Oqtane.Controllers.PageController.Post (Oqtane.Server)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST https://oqtane-poc324.oqtane.me/api/Page - 200 - application/json;+charset=utf-8 20.1753ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 PUT https://oqtane-poc324.oqtane.me/is01/api/Page/?siteid=3&pageid=84&parentid= - - 0
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Oqtane.Controllers.PageController.Put (Oqtane.Server)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[102]
      Route matched with {action = "Put", controller = "Page", page = ""}. Executing controller action with signature Void Put(Int32, Int32, System.Nullable`1[System.Int32]) on controller Oqtane.Controllers.PageController (Oqtane.Server).
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[105]
      Executed action Oqtane.Controllers.PageController.Put (Oqtane.Server) in 50.3013ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Oqtane.Controllers.PageController.Put (Oqtane.Server)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 PUT https://oqtane-poc324.oqtane.me/api/Page/?siteid=3&pageid=84&parentid= - 200 - - 51.5129ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST https://oqtane-poc324.oqtane.me/is01/api/Log - application/json;+charset=utf-8 -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Oqtane.Controllers.LogController.Post (Oqtane.Server)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[102]
      Route matched with {action = "Post", controller = "Log", page = ""}. Executing controller action with signature Void Post(Oqtane.Models.Log) on controller Oqtane.Controllers.LogController (Oqtane.Server).
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[105]
      Executed action Oqtane.Controllers.LogController.Post (Oqtane.Server) in 2.0121ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Oqtane.Controllers.LogController.Post (Oqtane.Server)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST https://oqtane-poc324.oqtane.me/api/Log - 200 - - 3.4011ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 GET https://oqtane-poc324.oqtane.me/pg1 - - -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Fallback {*path:nonfile}'
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Fallback {*path:nonfile}'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/2 GET https://oqtane-poc324.oqtane.me/pg1 - 302 - text/html;+charset=utf-8 51.0095ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 GET https://oqtane-poc324.oqtane.me/404 - - -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Fallback {*path:nonfile}'
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://oqtane-poc324.oqtane.me/api/User/name/tonci/-/?siteid=1 - - -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Oqtane.Controllers.UserController.Get (Oqtane.Server)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[102]
      Route matched with {action = "Get", controller = "User", page = ""}. Executing controller action with signature Oqtane.Models.User Get(System.String, System.String, System.String) on controller Oqtane.Controllers.UserController (Oqtane.Server).
info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
      Executing ObjectResult, writing value of type 'Oqtane.Models.User'.
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[105]
      Executed action Oqtane.Controllers.UserController.Get (Oqtane.Server) in 5.884ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Oqtane.Controllers.UserController.Get (Oqtane.Server)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://oqtane-poc324.oqtane.me/api/User/name/tonci/-/?siteid=1 - 200 - application/json;+charset=utf-8 6.6118ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://oqtane-poc324.oqtane.me/api/Setting?entityname=User&entityid=1 - - -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'Oqtane.Controllers.SettingController.Get (Oqtane.Server)'
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[102]
      Route matched with {action = "Get", controller = "Setting", page = ""}. Executing controller action with signature System.Collections.Generic.IEnumerable`1[Oqtane.Models.Setting] Get(System.String, Int32) on controller Oqtane.Controllers.SettingController (Oqtane.Server).
info: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
      Executing ObjectResult, writing value of type 'System.Collections.Generic.List`1[[Oqtane.Models.Setting, Oqtane.Shared, Version=5.1.2.0, Culture=neutral, PublicKeyToken=null]]'.
info: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[105]
      Executed action Oqtane.Controllers.SettingController.Get (Oqtane.Server) in 0.8844ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Oqtane.Controllers.SettingController.Get (Oqtane.Server)'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://oqtane-poc324.oqtane.me/api/Setting?entityname=User&entityid=1 - 200 - application/json;+charset=utf-8 1.3188ms
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Fallback {*path:nonfile}'
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'Microsoft.AspNetCore.Routing.RouteEndpoint'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://oqtane-poc324.oqtane.me/_blazor?id=BEaWVRM2_lidxJDviTIj3A - 101 - - 56124.0848ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/2 GET https://oqtane-poc324.oqtane.me/404 - 200 - text/html;+charset=utf-8 34.8462ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 POST https://oqtane-poc324.oqtane.me/_blazor/disconnect - multipart/form-data;+boundary=----WebKitFormBoundary1GuLckNvNfa1hQhL 359


@tvatavuk
Copy link
Contributor Author

To quickly work around the issue, I modified SiteRouter.razor at line 560 to use !string.IsNullOrEmpty(alias.BaseUrl) instead of alias.BaseUrl != "".

image

However, this might not be an adequate solution. The problem likely stems from Null values being present where Empty.String was expected, indicating a some other deeper issue within the Oqtane codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant