Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5447

Networking and servers • Re: CORS assist

$
0
0
This worked for me on a Pi5-8GB getting JSON data from a Pi5-4GB running Apache2

Code:

pi@pi5-8GB:/var/www/html $ curl -L http://192.168.1.151/shared/data.json{  "id":  "sensor1",  "value": 12.34}
The Pi5 Apache server (192.168.1.151) 000-default.conf was simple:

Code:

<VirtualHost *:80>        ServerAdmin webmaster@localhost        DocumentRoot /var/www/html        ErrorLog ${APACHE_LOG_DIR}/error.log        CustomLog ${APACHE_LOG_DIR}/access.log combined        # allow cross origin        Header set Access-Control-Allow-Origin '*'</VirtualHost>

Statistics: Posted by neilgl — Tue Nov 26, 2024 10:28 am



Viewing all articles
Browse latest Browse all 5447

Trending Articles