https://github.com/pinebit/http-request-proxy
A very simple AJAX proxy written in PHP
https://github.com/pinebit/http-request-proxy
Last synced: 8 months ago
JSON representation
A very simple AJAX proxy written in PHP
- Host: GitHub
- URL: https://github.com/pinebit/http-request-proxy
- Owner: pinebit
- License: mit
- Created: 2017-08-25T16:58:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-30T15:55:28.000Z (over 6 years ago)
- Last Synced: 2025-06-09T13:09:44.460Z (10 months ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 12
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SIMPLE HTTP REQUEST PROXY (in PHP)
This is a simple implementation of HTTP request (AJAX) proxy script which you can add to your webserver.
The purpose of this script is simple: proxy all HTTP requests being made from one domain to another. This is in particular useful to avoid CORS issues when you cannot make HTTP requests to a certain server.
## Usage
First of all, please examine `.htaccess` file contents. You will need to add a rewrite rule to your server's .htaccess file, similar to the provided example.
Secondly, you need to put the two php files into the server root.
Finally, you need to edit `proxy.php` to specify your target HTTP API server as well as other options as needed. All configurable settings are on top of the file.
## Features
* The script uses vanilla PHP, should work with php 5.x,
* Currently supports GET and POST requests, but can be easily extended to support other HTTP methods,
* Copies all cookies to/from a request,
* HTTPS ready.
## Contents
* `proxy.php` is the main script, it is self-descriptive,
* `http_build_url.php` a helper function borrowed from https://github.com/jakeasmith/http_build_url,
* `.htaccess` a sample server configuration that feeds HTTP requests to `proxy.php` script.
## License
MIT