Hello at all,
I’m trying to create a client script in PHP using curl to call REST API from Frappe / ERPNext.
This is working great with GET, but PUT or POST gibts me 417 error. I’m using v14
My system setup is as follow:
- Linux Server with Ubuntu and Apache
- my PHP script using Apache with SSL and http2
- Frappe / ERPNext is installed locally without Docker
- Frappe / ERPNext is using built-in nginx on port 8080
- server uses two domains:
- mysite.com uses my PHP script
- crm.mysite.com uses ERPNext
- both sites uses SSL certificate
- crm.mysite.com also Apache with this proxy config:
ProxyRequests Off
ProxyTimeout 120
ProxyPass "/.well-known/" "!"
ProxyPass "/AutoDiscover/" "!"
ProxyPass "/mail/" "!"
ProxyPass "/cgi-bin/" "!"
ProxyPass "/assets/" "!"
ProxyPass "/files/" "!"
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=polling [NC]
RewriteRule /(.*) http://localhost:9000/socket.io/$1 [P,L]
RequestHeader set Host "crm.mysite.com"
RequestHeader set X-Frappe-Site-Name "crm.mysite.com"
ProxyPass "/socket.io" "http://localhost:9000/socket.io/"
ProxyPassReverse "/socket.io" "http://localhost:9000/socket.io/"
<Location "/socket.io">
RequestHeader set X-Frappe-Site-Name "crm.mysite.com"
</Location>
Alias "/assets" "/home/frappe-user/frappe-bench/sites/assets"
<Directory /home/frappe-user/frappe-bench/sites/assets>
Options FollowSymLinks
Require all granted
</Directory>
Alias "/files" "/home/frappe-user/frappe-bench/sites/crm.mysite.com/public/files"
<Directory /home/frappe-user/frappe-bench/sites/crm.mysite.com/public/files>
Options FollowSymLinks
Require all granted
</Directory>
ProxyPass "/" "http://localhost:8080/"
ProxyPassReverse "/" "http://localhost:8080/"
<Location "/">
RequestHeader set X-Frappe-Site-Name "crm.mysite.com"
</Location>
If I call the API with PUT or POST then I get 417.
When I use “curl -I -L https://mysite.com” gives HTTP/2
“curl -I -L https://crm.mysite.com” gives HTTP/2
“curl -I -L 127.0.0.1:8080” gives HTTP/1.1
So my question is: how to put the built-in nginx from Frappe to http2?
If I change the config from “listen 80;” to “listen 80 http2;” then the server does not start.
I also tried my curl script to add a new header:
$header = ['Content-Type' => 'application/json',
'Accept' => 'application/json',
'Expect' => ''];
Does anyone have an idea?
Thanks,
Tobias