Problems with SetHttpHandler and JS POST request

Hey there! I tried to create a POST request with JS, which should send some information to my FiveM-Server. But it won’t work as expected. When I send the POST request, then the console of my Browser says, that this can’t be done, because the website sending the request is loaded over HTTPS, but the URL to the FiveM-Server is just HTTP. Is it even possible to secure the HttpHandler with HTTPS? I already tried, to just change the protocol of the URL. So that it doesn’t go to http://server-domain.de/script/ but to https://… But then my console says net::ERR_CERT_AUTHORITY_INVALID. My server is reachable through an domain. This domain is HTTPS-secured.

What could I do?

Use your cfx.re domain since that one has a valid TLS certificate or How to replace the server TLS certificate with your own

Use your cfx.re domain

You mean that one like https://cfx.re/join/…?
I changed it to this one, but now nothing happens. Not even an error. And if I access to this URL via my web browser, I’ll come to this website: https://image.scania01.de/chrome_01_22_21__18_14_30.png

No your https://scania01-blabla.cfx.re/resource/yourendpoint

Oooohhhh, now I understand. I’ve never knowed what is this adress for :sweat_smile:

Well, I’ll try this…

Okay, it works now. Thank you for the help!

1 Like

How do you find your cfx.re domain? Is there a standard format for them?

1 Like

It appears in the server console after start
image

Or programatically GetConvar("web_baseUrl", "")