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

def hello_world():
    return render_template("index.html")
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)

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:


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

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!


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.