HTTP-functions stopped working on my www. site but work on exact copy free site

HTTP-functions stopped working on my premium site but work on exact copy free site

on August 14 2023 clients could use an API on my site. When they tried to use it again last week it no longer worked and the coding in http-functions had not changed.

After several long days of trying to solve this I made an exact duplicate of the premium site to a free one with identical code and the http-functions work okay.

Obviously the end points used to access the API by clients are different.

Please fix or help me. Thank you

Were there any changes in the domain name for the premium site where your HTTP Functions are hosted?

Please note the endpoints for calling your API can change depending on whether you are developing on a premium site. These are the formats for calling http function endpoints:

Premium sites

https://www.{user_domain}/_functions/{functionName}

Free sites

https://{user_name}.wixsite.com/{site_name}/_functions/{functionName}

I would also check the Site Event Logs to verify if there are any errors with calling the http function endpoints.

Thank you for the swift reply.

Yes I am aware of the different endpoints and i have double checked them.

Note the code I sue to call them was never changed so everything has been static.

I monitored the logs and see the correct activity and outputs for the copy free site but nothing at all shows or happens on the premium site.

There have been no changes to the domain.

I am trying to post to the api.

Note the simple multiply example given in the wix template works but this does use a post function.

Try to capture the response on your POST method endpoint on the premium site. If you are using the classic editor, you can also use the Functional Testing functionality to directly call your http function.

If there are errors, posting them here (without PII such as urls/domains) could help solve this issue.

Thank you very much for your help.

There is zero response to the POST to the premium site which tends to indicate a back end connection problem on your servers as it appears nothing at all happens and no code is executed. I’ve tried inserting console logs etc to monitor progress but nothing comes back.

There is a full working response to the POST method using the identical code except for the change in end point on the FREE site

The code worked perfectly a few months ago and nothing has changed.

I ve spent many hours on this and cannot fix

Just to add:

In the classic editor yes I can get parts of the API on http-functions to work using the Functional Testing on the Premium Site.

Therefore it does seem to be a “connection” error when external POST requests access the API. on the Premium site and not the Free site.

Please help or fix thank you

SOLVED

You need to add a user agent when using curl to send a POST to http functions API on Premium sites

This is new as previously you did not.

NOte no user agent was required on the FREE site endpoint for a curl POST

2 Likes

Hey I’m having the same issue-- would you mind elaborating a bit on how you solved this?

HI,

From memory I had to put a user agent in the api code for the premium site (was not required for the free site or previously for the premium site)

e.g. $agent = ‘Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)’;

This being a line in the php code used by third parties to access the api on my site.

It took me days to work it out. Wix does change things sometimes and does not always tell everybody about the impact on websites which require updating.

Hope that works for you.