https: prefix not used in some admin function

This may be an issue of my understanding but I have the Vagrantfile directing port 8082 to port 443 as shown below, but when using the a number of admin functions eg maintenance/Advance Settings the confirmation screen appears to drop the https and replace with http: causing the following error.

As yet I have not created an ssl certificate but have asked Mozilla to carry on regardless.

400 Bad Request

Bad Request

Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.

Hint: https://localhost.localdomain/

Apache/2.2.15 (CentOS) Server at localhost.localdomain Port 443
**VAGRANTFILE**
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
# Paul Chinn
# For public_network forwarded_port from the static ip of the server
  config.vm.network :forwarded_port, guest: 8080, host: 8081, host_ip: "192.168.8.202"
  config.vm.network :forwarded_port, guest: 443, host: 8082, host_ip: "192.168.8.202"
  config.vm.network :forwarded_port, guest: 80, host: 8083, host_ip: "192.168.8.202"
  config.vm.network "public_network"
# Paul Chinn end
  config.vm.box = "bahmni-team/bahmni"
  config.vm.box_check_update = true
  config.ssh.insert_key = false
# Paul Chinn commented out config.vm.network "private_network",ip: "192.168.1.30"
  config.vm.synced_folder "..", "/bahmni", :owner => "vagrant"
# Paul Chinn increased memory fro 3092 to 4096
  config.vm.provider "virtualbox" do |v|
     v.customize ["modifyvm", :id, "--memory", 4096, "--cpus", 2, "--name", "Bahmni-RPM"]
  end
end

I wonder if anyone can help on this?

Hi @mafrica ,

Can you provide the HTTP request that returns 400 error. (you can capture the request using dev tools in browser or any HTTP tracing tool)

view-source:http://kivulini-2:8082/openmrs/admin/patients/patientIdentifierType.list

This is from Chrome show source. Manually correcting to https://etc fixes the problem, but of course this would not be acceptable in production.

I guess Deepak wanted to see the full network traffic to figure out the problem cause.

You can get it like this with the Google Chrome browser:

(1) Open the developer tools: See Chrome DevTools - Chrome Developers (2) Go to the “Network” tab in the developer tools

(3) Press the “Clear” button to reset the HTTP tracing (4) Open the website which causes the failure described above (5) Click on the details of the request with the status code “400” (6) Make screenshots of all interesting details, e.g. the “Headers” and “Preview”.

By the way, Mozilla is not an officially supported browser and there a few places where it doesn’t work. I recommend using Chrome or Chromium in production. See System Requirements#Devices Supported by Bahmni

Thanks for pointing out the Mozilla issue.

Sorry for the slow response - just emerging from a 2 day power cut.

I did as you suggested but I fear there is little in the way of new information. As I said the problem is not a 400 but a call using the http:// prefix with an ssl port number.

Here is the output:

Just some ideas from a Bahmni beginner:

  1. It should be possible to configure an HTTPS redirect in the Apache configuration. See https://wiki.apache.org/httpd/RedirectSSL (Disclaimer: I havn’t done this by myself yet and I don’t have time to dig it.)
  2. Maybe the problem is that the UI just displays the wrong link. Can you please describe the detailed steps you did (like to a four-year-old) so that it would be possible to figure out the exact location in the source code.

Off-toppic remark: I am not sure if it’s a good idea to use the Virtual Box for a production deployment. I have raised a question about this here: https://talk.openmrs.org/t/using-the-bahmni-vagrant-box-in-production Maybe this problem would not exist if you use a dedicated CentOS server.

The problem seems to occur in large parts of the openmrs/admin area when completing an action.

As an example go to manage locations, choose one, do nothing to it an then save. The error occurs following the save when it is trying to repaint the list ok known locations.

On production use of Vagrant Box I have some fears, but I am operating a very low IT resource situation and I hope to be able to leave the box as an appliance with minimal intervention with just Windows knowledge in the post implementation team.

I will let you know how it works out.

For now still can’t figure why links are sometimes not https:??