Skip to content

Google Cloud Run HTTPS errors #152

Description

@blackshot

when zero app is deployed on Google Cloud Run everything works except http api calls because they get blocked because of "Mixed Content"

example:
route /api/users (python handler)

from flask import jsonify
def handler():
    return jsonify(users=[f"u{i}" for i in range(10)])

and some React component with api call at /index.tsx

function Users(){
    const [users, setUsers] = useState(null)
    useEffect(() => {
        fetch('/api/users').then(res=>{
            const {ok} = res;
            if (!ok) throw new Error("Error searching users");
            return res.json()
        }).then(data=>setUsers(data));
    }, [])

    if (!users) return <span>Loading...</span>
    return(<ol>{users && users.users.map(u => <li key={u}>{u}</li>)}</ol>);
}

results in every api call made to /api/users gets 308 HTTP response (Permanent redirect) to the same url/route (dont know why) then gets blocked because they are not using HTTPS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions