0

I have a page public with Flask, using like handler Wfastcgi and IIS to compilate. The site works correctly using https but when i write the site with http that broke with timeout.

I tried changing in my index.py but didn't work, i used this:

@app.before_request
def bef():
    if not request.is_secure:
        url = request.url.replace('http://', 'https://', 1)
        code = 301
        return redirect(url, code=code)
        else pass

I tried too create a URL rewrite rule at IIS to redirect HTTP to HTTPS but didn't work.

Is like if the request never in by the HTTP port because i tried print with if not request.is_secure and never printed even "hello world". Maybe the mistake is produced for the wfastcgi because only is activated to HTTPS but i dont know who i could activate with HTTP, i searched in the file and saw this: record.params['wsgi.url_scheme'] = 'https' if record.params.get('HTTPS', '').lower() == 'on' else 'http'.

I add too the line handler in the web.config, maybe is wrong.

<add name="FlaskHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python\python.exe|C:\Python\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />

Thanks for all

  • Could you please provide the complete error message? – JennyDai May 17 '22 at 08:31
  • The site doesn't print error, it keeps charging. Flask doesn't show error either, when i upload the website at venv that show me this: ```* Serving Flask app 'indexhttps' (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on https://127.0.0.5:5000/ (Press CTRL+C to quit)``` So it's uploading ok with https – Victor Nino Vargas May 17 '22 at 12:39
  • You can try to use the failed request trace to view the detailed request process, if not, you can also use fiddler to capture. – JennyDai May 18 '22 at 09:54
  • Now the browser show me ```[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.``` – Victor Nino Vargas May 23 '22 at 13:22
  • Can't see raw response, it's hard to find out reason. Try the following: 1. Download DebugView https://learn.microsoft.com/en-us/sysinternals/downloads/debugview 2. In Fiddler's black QuickExec box under the session list, type !spew and hit Enter. Fiddler will begin spewing verbose logging information to DebugView, including all reads and writes to/from the network. Far more information about the failed request is then shown in DebugView. – JennyDai May 25 '22 at 09:38

0 Answers0