Bananas Development Blog: share your thoughts

XHTTP-Request und Zugirffskontrolle via htaccess

hmm schon komisch aber darauf kommt man leider erster immer wenn man schon Stunden sich geärgert hat.

Wenn man eine Seite vor Zugriffen schützen möchte, hat man ja die Möglichkeit via htaccess and Apache eine Benutzerabfrage zu erstellen.
Geht ganz schnell und ist einfach zu realisieren.

Nun hat man aber das Problem, wenn die Anwendung die dahinter ist, XHTTP-Reuqests verwendet ( für die Saubermänner unter euch, ich meine AJAX ). Denn diese fallen auf die Nase.

Ja aber warum ?

Nun der Schutz mit der Benutzerabfrage via Apache und htaccess, greift natürlich auf für die XHTTP-Requests !!

hmm und wie bekommt man das trotzdem zum laufen ?

Man muss seine htaccess Regeln ein wenig erweitern:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
require valid-user


Daraus machen wir:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
<LimitExcept POST>
require valid-user
<:/LimitExcept>


Nun sind die Anfragen via POST ohne Anmeldung erlaubt.
Ich denke nicht, dass dies die beste Lösung ist, und vorallem nicht auf dauer, aber auf die schnelle und bis zur Freischaltung sollte dies genügen.

Banana
out.
  • No comments

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Trackbacks / Pingbacks

  • No Trackbacks