So, Iv'e been trying to setup a small example of a server with 2 factor authentication features. I'm using nuxt
as the frontend and flask
as the backend.
While developing locally (using npm run dev
) I was able to get the chain of communication to work:
server/<some_request>/<some_param>
proxy
module redirects it to http://localhost:5000/<some_request>/<some_param>
axios
moduleflask
receives the request, processes it and answers.When trying to deploy this application to a dreamhost server, I used npm run build
and npm run generate
to serve the website statically. I was able to receive my webpage when browsing.
But when trying to login, the chain described above broke, and requests to server/<some_request>/<some_param>
were answered with 404. In the server's command line I saw that flask
didn't receive any request, so I assume that this is some issue with the proxy
module.
I'm not really sure how to debug this problem, so any help or ideas will be appreciated.
Okay, so I got everything working, and here are my conclusions:
proxy
module, makes the redirection in the client side, meaning that I would be trying to access my own machine when redirecting to localhost:5000
, rather than to the server.proxy
module can't be used when using npm run generate
(there's a warning that says it's disabled).flask
from the client side (browser), I couldn't just run it as is. I had to register another subdomain and use Passenger to deploy my app (A guide to enabling passenger, getting started with python in passenger and A great guide to deploying flask over passenger).