Learn more about these different git repos.
Other Git URLs
When https is forced (which is currently is also on copr-fe-dev) and copr-cli uses http URL
# ~/.config/copr [copr-cli] copr_url = http://copr-fe-dev.cloud.fedoraproject.org
then a very unfriendly error is produced
[jkadlcik@chromie cli]$ PYTHONPATH=/home/jkadlcik/git/copr/python ./copr create --chroot fedora-27-x86_64 @copr/TEST1547634391Project1 Something went wrong: Error: Request is not in JSON format, there is probably a bug in the API code.
There are some debugging information
ipdb> pp response.status_code 405 ipdb> pp response.text ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n' '<title>405 Method Not Allowed</title>\n' '<h1>Method Not Allowed</h1>\n' '<p>The method is not allowed for the requested URL.</p>\n')
Such response shouldn't be returned through API - there is always expected to be a JSON. Frontend should somehow recognize that it gets a http request while https is forced and return a custom error message and some appropriate status code (Maybe 505? I am not sure which one)
Btw., copr-fe-dev could put https:// there automatically on https://copr-fe-dev.cloud.fedoraproject.org/api/
Please see #504
I've unintentionally spent hours on this and I am really frustrated that I couldn't fix it and very curious how it should be solved.
The easy part is to catch 405 error with @app.errorhandler(405). Problem is that within it, we want to check the request, whether it was http, but we can't because the flask.request.scheme always gives https and flask.request.url gives
@app.errorhandler(405)
flask.request.scheme
https
flask.request.url
https://copr-fe-dev.cloud.fedoraproject.org/api_3/project/add/@copr?ownername=%40copr
And there is IMHO no evidence in flask.request.environ that the request was initially http and then redirected to https by
flask.request.environ
RewriteRule "^/?(.*)" "https://%{HTTP_HOST}/$1" [L,R=301,NE]
Do you have any hints?
Metadata Update from @praiskup: - Issue tagged with: meeting
Metadata Update from @praiskup: - Issue untagged with: meeting
After personal discussion, I've decided to solve this issue on client-side. Modified in PR#650
Merged, closing.
Metadata Update from @praiskup: - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.