URI parameters with ORDS causing 404 errors - oracle-apex

This URI is giving me a 404 error:
https://www.test222.com/vmdbagnt/plsql/Gate_Keeper.Get_Drawing_File/DART/CHRISORDS/J/2B945/17-JAN-2023/pg1/drawings/2B945_CHRISORDS_J.PDF
How can I modify the URL to work with ORDS? It worked fine with OHS.
For example I had this URL below that was giving me a 404 error:
https://www.test222.com/vmdbagnt/plsql/drawings_oas/apex?USR_DRAWING_ID=1F81234&KEYWORD_SEARCH&ANY_ALL=ALL&SORT_BY&THUMB&submit_P1=SEARCH
By removing the apex? and changing it to the following URL it worked perfectly with ORDS:
https://www.test222.com//vmdbagnt/plsql/drawings_oas?USR_DRAWING_ID=1F81234&KEYWORD_SEARCH&ANY_ALL=ALL&SORT_BY&THUMB&submit_P1=SEARCH

Related

FormatException: SyntaxError: Unexpected token < in JSON at position 1 in Flutter after changing proxy from HTTP to HTTPS

I have a project, backend with Django and frontend with Flutter framework. The project was working fine until I changed the proxy in my Nginx from HTTP to HTTPS. Still working in most cases without any Problem. just in some cases, where I have no Data in my Data Table, I want/have to return an empty list from the backend, I got an error:
GET https://servername/project-name/api/commitments/?email=emailaddress%40companyname.de&jahr=2022&kunde=adac-ev 500
FormatException: SyntaxError: Unexpected token < in JSON at position 1
code in flutter:
var uri = (APIPROTOCOL == 'http://')
? Uri.http(APIHOST, '/api/commitments/', uriQuery)
: Uri.https(APIHOST, '$APIHOST_PREFIX/api/commitments/', uriQuery);
try {
final response = await http.get(
uri,
headers: {"Authorization": "Bearer $authToken"},
);
And this is working on localhost and on a server with HTTP but the problem is only on a sever with HTTPS,
any idea? how can debug the code on the server? or how can I change my localhost from http:://localhost:protNumber/ to something like https://servername/project-name/. Any idea that could help me to debug the code with https?

How do I make an error handler with flask

I am creating a web application and I would like to do a styled 404 page not found if someone tries to enter one of my routes that is not created. Is there a way I can do this?
welcome to stackoverflow!
To create a error handler of any error code in flask you must do the following, for my example I will use a 404 error as requested in the post:
#app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
If you want to error handle a 505 just substitut the 404 for a 505 and create a new html file in templates

Django all auth facebook login with Use Strict Mode for Redirect URIs

Hi I am trying to implement Facebook login for my website using Django Allauth.
As we can no longer disable Use Strict Mode for Redirect URIs I am getting an error when I try to login via facebook.
The callback URL formed at the time of Facebook login is of this format -
https://example.com/accounts/facebook/login/callback/?code=AQB7W48oY-1XxZv2xU9iahxS80ZPs4oBNLlXWTY7Y93dclyIElEPG-jWKB5ELV7Pv11ckcRYg3L67Wfcz6xqC8yhNLBaFaOQjd4F2AEp8nfScltnY3LoY79g9NjtslCSbQnSlc_hDdBm_rxQtScz-rLChNvAJaky3KYMG_USSTkm9qdyvw5lIMdcIHQjz3CTF8KdgmuFG1T8_WvVqdGDEpfhC_PD7w5tnkcChBEowHnWR656DYa1wrMR1fbP2rqxBocNn6fKPCy_GM_DZynPp8mx0F0YP55vzw2Kv8KchB2nxCaHwQ4dRvJq785w5CfCgDVc6REhbc3CNG2KqZxdxjuG&state=eukVyjHYk04X#_=_
This URL contains the query params code and state because of which it is not an exact match and I checked it via Redirect URI to Check which reported it as invalid.
So on the authentication_error.html I get the following error.
{'provider': 'facebook', 'code': 'unknown', 'exception':
OAuth2Error('Error retrieving access token:
b'{"error":{"message":"Can\'t load URL: The domain of this URL
isn\'t included in the app\'s domains. To be able to load this
URL, add all domains and sub-domains of your app to the App Domains
field in your app
settings.","type":"OAuthException","code":191,"fbtrace_id":"AxoTkIBeoUSKsxuWvMx-Wg4"}}'',)}
My Valid OAuth Redirect URIs has the following URL's
https://example.com/accounts/facebook/login/callback/
https://www.example.com/accounts/facebook/login/callback/
Please help me with this issue, I have looked into all the existing issue but haven't found a solution.
For anyone facing a similar issue, it could be because you missed to add this line to your settings.py file.
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'

django-rest returning http 301 status code when calling http delete without trailing slash

I recently experienced that on django rest framework a http 301 status code is returned when making a delete request, without including the trailing slash in the url when trailing_slash=True. While missing the trailing slash on a post request would return a runtime error. So my question is, is this a bug or is it expected behavior?
The 301 is expected because Django redirects you to the URL with the trailing slash since you have trailing_slash=True. See APPEND_SLASH settings if you want to change that.

In Python 2.7.5, how can I check domain resolution if the ISP is hijacking 404 responses?

I am trying to validate that a domain name returns an http status of 200, 301, or 302. I've run into a case where the domain name is not valid, however returns a 200 status because the ISP hijacks the 404 response and redirects it to a proprietary search page. This makes the domain name appear valid, when it is not.
>>> r = requests.head(url='http://defdoesnotexist123.com', allow_redirects=False)
>>> r.status_code
200
>>> r.url
u'http://defdoesnotexist123.com/'
In this case, the user is actually redirected to http://finder.cox.net instead of seeing a 404 page. Is there a way to check for this so that I can have my logic fail and consider the domain name invalid?
A DNS failure is not a 404 error. A 404 requires there to be an actual resolvable domain and a server responding, it means the path doesn't exist, but the server does. Your ISP is intercepting DNS failures, which is an error condition that occurs before HTTP is involved at all, while 404 is a HTTP error code.
If your ISP intercepts all DNS records and redirects you to a new URL, look for the Location header:
r = requests.head('http://defdoesnotexist123.com')
if 'finder.cox.net ' in r.headers.get('location', ''):
# domain doesn't actually exist, redirected to the catch-all page
Note that requests.head() has allow_redirects set to False by default, you don't need to set it explicitly.