Flask werkzeug url redirect not working

Hi All,
I'm going crazy.... I'm using Posit Workbench, but I'm just dummy.

I have a Python Flask website very simple.

from flask import Flask, render_template
app = Flask(__name__)
import os


@app.route('/')
def hello_world():
    return render_template("index.html")
@app.route('/bye')
def bye_world():
    return "bye world"


if __name__ == '__main__':
    # When running in Posit Workbench, apply ProxyFix middleware
    # See: https://flask.palletsprojects.com/en/2.2.x/deploying/proxy_fix/ 
    if 'RS_SERVER_URL' in os.environ and os.environ['RS_SERVER_URL']:
        from werkzeug.middleware.proxy_fix import ProxyFix
        app.wsgi_app = ProxyFix(app.wsgi_app, x_prefix=1)
    app.run()

I can see the proxied server on the proxied list, and click on the link it works and shows correctly the index page. This page is just:

<html>

</html>
<body>
    <a href="/bye">Bye</a>
</body>

When I click on the Bye link I expect to be redirected to http://positserver.com/p/blabla/s/blabla/bye
but I'm redirected to http://positserver.com/bye

What I'm doing wrong?

Thank you!

Solved.

In Index.html I've to put ./bye instead of /bye....trivial

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.