Skip to content

Double prefix when using reverse proxy and url_prefix with grid in _dashboard app #1003

@DavidiBeMe

Description

@DavidiBeMe

I have run into this issue in multiple setups.
Steps to reproduce:

  • install and run py4web using a url_prefix
  • configure nginx or apache to serve as a reverse proxy for the instance of py4web
  • You will need to remove the leading slashes in the URL functions in the index.html of the _default app as the url paths are not relative and so the buttons defined in the default app don't work when using a url_prefix. Alternatively you can just enter the url for the _dashboard manually in your browser.
  • go to the _dashboard and click on the _scaffold app
  • go to the databases section and click on auth_user
  • click on the New button
  • you should get a 404 error because the url_prefix is in the url 2x

The cause of this seems to be coming from core.py where the url_prefix is added twice when you click on the auth_user table which triggers the creation of a grid which builds the url. I have proposed a fix in a PR, although it is maybe more of a workaround.

This important for us to have fixed as we are migrating from web2py and the only alternative is a rewrite in our apache config. Adding a rewrite is not a good option for us because the double url_prefix will still be visible in the apps when hovering and it will really complicate our config files for Apache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions