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

How to redirect from "/" to a specific db/table #2027

Open
dmick opened this issue Feb 18, 2023 · 4 comments
Open

How to redirect from "/" to a specific db/table #2027

dmick opened this issue Feb 18, 2023 · 4 comments

Comments

@dmick
Copy link

dmick commented Feb 18, 2023

Using nginx to redirect public IP to the local uvicorn server as 'normal'. I can't figure out how to redirect such that '/' results in accessing the one db/table I want to serve; redirecting / to /db/table breaks some of the CSS; fooling with base_url doesn't seem to help. Can someone explain this, if it's possible?

@dmick dmick changed the title How to redirect from / to a specific db/table How to redirect from "/" to a specific db/table Feb 18, 2023
@gk7279
Copy link

gk7279 commented Feb 22, 2023

Can you please help or share your expertise with #2030 ?

@dmick
Copy link
Author

dmick commented Feb 22, 2023

Was that query to me, @gk7279?

@gk7279
Copy link

gk7279 commented Feb 22, 2023

yes @dmick . How did you make your public IP redirect to your uvicorn server?

Instead of nginx, I have apache2 on my GCP VM. Any pointers here are helpful too.

Thanks.

@dmick
Copy link
Author

dmick commented Mar 8, 2023

I managed to make it work by using nginx's 'exact match' (=) combined with 'prefix match'; that is, match explicitly on /, and redirect to /<db>/<table>, and then have the normal ProxyPath for the unadorned (prefix-matching) /.

        location = / {
                return 302 /<db>/<table>;
        }
        location / {
                proxy_pass http://127.0.0.1:8001/;
                proxy_set_header Host $host;
        }

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

2 participants