How to send fetch request from HTTPS to a HTTP server : Mixed Content error - rest

I am using a NextJs app where I am using a simple fetch to send some POST data.
We I used app on localhost it worked fine but when I put it on the server it got following error.
Mixed Content: The page at 'https://speechwithai.com/home' was loaded
over HTTPS, but requested an insecure resource
'http://18.224.190.161:5000/fileToText'. This request has been
blocked; the content must be served over HTTPS.
The from and to are both on same IP address (https://speechwithai.com/). At the back I am running NGINX to server WebAPP at port 80 and Flask REST API at 5000. I am using Flask because I needed python libraries to process some files.
I tried multiple post but I did not find any solution. Could someone please help me?
All I want is to send a request to my FLASK API server which is running
http://someIPAddress:5000 from https://myLiveNextJsApplication.com

Since both servers are running behind same server and you already have nginx setup.
follow these steps
setup reverse proxy for flask
with some thing like below
events {}
http {
server {
listen 443;
location /flask_api {
proxy_pass http://127.0.0.1:5000/;
}
nginx configuration resides in /etc/nginx/nginx.conf
.
For more information visit https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
configure ui to use this flask_api
url = https://speechwithai.com/flask_api
update flask path route to use /flask_api

Related

redirect http request to https on ION webRTC server

I am using (https://pionion.github.io/) for my streaming server. To run the server I am using its docker service. And I am getting access over 'HTTP' only. Now I want my request to 'HTTPS' (ex. https://ip-address:5551)
Is there any configuration file to do so? I need help here.

Spinnaker Gate is redirecting to the incorrect authentication URL

So I have spinnaker running behind an https load balancer and my external ports use the standard 443 which get port mapped to the spinnaker instance still on port 9000. I've gotten pretty much everything to work except a redirect from gate is still appending the :9000 port to my URL.
requests sent to https://my.url.com/gate/auth/redirect?to=https://my.url.com/#/infrastructure send back a redirect response with the location header in the 301 location:https://my.url.com:9000/gate/login which fails because the load balancer is only listening for 443. If I manually delete the port and go right to https://my.url.com/gate/login the oauth flow works as expected and once authed all deck functionality and subsequent gate queries work as expected.
In my /etc/default/spinnaker file I have
SPINNAKER_DECK_BASEURL=https://my.url.com
SPINNAKER_GATE_BASEURL=https://my.url.com/gate
in /opt/spinnaker/config/gate-googleOAuth.yml I have
spring:
oauth2:
client:
preEstablishedRedirectUri: ${SPINNAKER_GATE_BASEURL}/login
useCurrentUri: false
and I've ran /opt/spinnaker/bin/reconfigure_spinnaker.sh plus restarts to make sure deck and gate get updated. Does anyone have any ideas what I might be missing?
I figured out my problem. With the help of this issue pointing me in the right direction (https://github.com/spinnaker/spinnaker/issues/1112) and some digging I found that the issue was with apache2 and the reverse proxy back to gate.
ProxyPassReverse
This directive lets Apache httpd adjust the URL in the Location, Content-Location
and URI headers on HTTP redirect responses. This is essential when Apache httpd
is used as a reverse proxy (or gateway) to avoid bypassing the reverse proxy because
of HTTP redirects on the backend servers which stay behind the reverse proxy.
from apache2 documentation https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassreverse

Redirect https request on local network

I'm trying to implement a local web server that handle all the http requests.
Basically, when a user connect to the network and open an url, he is redirected to my local web server.
I'm using dns mask for this purpose and it works pretty well for HTTP traffic.
The problem is with the HTTPS traffic (especially the case when a user perform a search in the chrome navigation bar).
I tried running the server on https with some iptables rules without success.
Is there a way to redirect the https traffic to my local web server ?
Thanks

http tp https forward some requests in haproxy

Currently all traffic is coming to backend servers, which is running on port 80. However we want to redirect some pages to https. This means that whenever the customer hits on login page, logout page present in the website. It should be redirected to https.
When a customer hits on the login button it redirect to https but using haproxy it doesn't work.
https://XXXXXXXX.com/customer/account/login/
We have already installed ssl in both the servers.
However, redirection is not working from http to https.
Please suggest what I should try.
It would be best to use HAproxy to terminate the SSL and talk to the backend servers via HTTP rather than having both HAproxy and the webserver doing SSL.
There is a good SSL setup tutorial here https://www.digitalocean.com/community/tutorials/how-to-implement-ssl-termination-with-haproxy-on-ubuntu-14-04

Apiary Proxy Request Timed Out

I'm trying to use Apiary to document my API and test requests but I keep getting a response 504 Proxy Request Timed Out.
My API is running on my machine under http://localhost:3000/ and I specified that under the HOST metadata.
When I click compare under the call, it shows that Apiary added a header "host" that specifies a user specific proxy.
Is there something I am missing or does Apiary just not like localhosts?
Because the proxy remotely calls your specified HOST, you cannot directly call localhost. You could could use https://ngrok.com and set up a tunnel and use the tunnel URL as the HOST.