Giter Site home page Giter Site logo

http-request-proxy's Introduction

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

http-request-proxy's People

Contributors

evan1989 avatar pinebit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.