piccolo-orm / piccolo

A fast, user friendly ORM and query builder which supports asyncio.
https://piccolo-orm.com/
MIT License
1.44k stars 90 forks source link

Page admin is not displayed in https mode, but in http it work well #763

Closed Edw125 closed 1 year ago

Edw125 commented 1 year ago

Hello. I want to build service that includes piccolo admin. Basically everything is great, but I installed the certificates SSL on my dev server and I ran into a problem. I have the following components: nginx, fastapi, piccolo orm and admin. When I try to open the site in dev mode with using ssl I get page without static like this image in logs I see what subrequests are sent with 404 code image I understood that static files such as html css js are located in folder venv/lib/...., but in docker I didn't find it. Maybe need configure in any way nginx to serve static?

How to solve this? Thanks for answers

dantownsend commented 1 year ago

Piccolo Admin serves its own static files, so you shouldn't have to worry about that.

create_admin has an argument called allowed_hosts which adds extra security when running under HTTPS:

https://piccolo-admin.readthedocs.io/en/latest/asgi/index.html#source

Try setting that to ['telegram-access.ddns.net'].

create_admin(..., allowed_hosts=['telegram-access.ddns.net'])
Edw125 commented 1 year ago

I already tried that image but I think the problem in nginx image

dantownsend commented 1 year ago

Hmm, it looks ok. Maybe try a trailing slash on location /admin, so it's location /admin/

Edw125 commented 1 year ago

This is work solution. Thanks! )