Setting up apache basic authentication behind a reverse proxy

79

I've determined the problem was that I had not enabled the ProxyPassReverseCookieDomain directive:

ProxyPassReverseCookieDomain external_addr server1

Hope this helps someone in the future

Share:
79

Related videos on Youtube

eSp
Author by

eSp

Updated on September 18, 2022

Comments

  • eSp
    eSp over 1 year

    I currently got the following piece of code:

    captureFile = theCaptureFile;
        // If there is only 1 currency it gets the total right away
        if (captureFile.getTotalMoney().size() == 1) {
            Money totalMoney = captureFile.getTotalMoney().values().iterator().next();
            totalAmount  = totalMoney.getAmount();
            currencyCode = totalMoney.getCurrencyCode();
        }
        // If there is more than one currency, goes through every one, converts it to GBP and adds it to the total amount
        else if (captureFile.getTotalMoney().size() > 1) {
            Map<String, Money> totals = captureFile.getTotalMoney();
    
            for (Entry<String, Money> money : totals.entrySet()) {
                try {
                    totalAmount = totalAmount + money.getValue().getEquivalent(BASE_CURRENCY).getAmount();
                } 
                catch (CurrencyNotFoundException e) {
                    LOG.error("Getting ExchangeRate:", e);
                    totalAmount = null;
                    break;
                } 
                catch (ExchangeRateNotFoundException e) {
                    LOG.error("Getting ExchangeRate:", e);
                    totalAmount = null;
                    break;
                }
            }
        }
    

    When the code gets called, the first IF works just fine but, in case there are more than 2 currencies, I get a NullPointerException on the TRY bit. None of those methods have a return null so I'm guessing it is something wrong that I am doing on the mapping part to pull the values out.

    Here are the other 2 methods that are pulled off:

    public Money getEquivalent(String targetCurrencyCode) throws CurrencyNotFoundException,ExchangeRateNotFoundException {
        if (this.currencyCode.equals(targetCurrencyCode))   {
            return this;
        }
        return getEquivalent(CurrencyCache.get().getCurrency(targetCurrencyCode));
    }
    

    and:

    public long getAmount() {
        return amount;
    }
    

    Any help would be greatly appreciated, any more info you might need just let me know.

    Many thanks in advance.

    • mklauber
      mklauber almost 13 years
      The proxy match code is currently disabled. IT was from an attempt to move the authentication forward to the web facing server. This failed because I realized every edit was simply coming as an anonymous user. I did add the ProxyVia On with no luck.
    • Andreas Fester
      Andreas Fester about 9 years
      Can you post the stack trace you get?
    • Kalaiarasan Manimaran
      Kalaiarasan Manimaran about 9 years
      You can change totalAmount = null; to totalAmount = "" in the catch blocks and give a try.why you want to make totalAmount to be null if for a particular iteration of loop is throwing the exception
    • riccardo.cardin
      riccardo.cardin about 9 years
      You never check for nullability your variable. Something like money.getValue().getEquivalent(BASE_CURRENCY).getAmount() could generate a NPE very easily.
    • eSp
      eSp about 9 years
      @Andreas: java.lang.NullPointerException at CaptureFileInsertOracle.init(CaptureFileInsertOracle.java:46‌​)
    • eSp
      eSp about 9 years
      @KalaiarasanManimaran: Because I will later pass those to the DB and if it can't calculate I want it to be passed as null.
    • Stephen C
      Stephen C about 9 years
      @eSP - that isn't a stacktrace. That is just the first line of a stacktrace ... and it doesn't offer any real clues.
  • mklauber
    mklauber almost 13 years
    I will do, as soon as allowed.
  • tucuxi
    tucuxi about 9 years
    that assumes that totalAmount is a Long or an Integer (we would need to see its declaration to know for sure) - an alternative explanation would be money.getValue() returning null
  • Sergey Kalinichenko
    Sergey Kalinichenko about 9 years
    @tucuxi There is no assumption here: totalAmount is assigned getAmount() in the first branch, and OP shows getAmount()'s signature, which returns long. In the exception handler OP assigns null to totalAmount, its type must be Long.
  • tucuxi
    tucuxi about 9 years
    please correct me if I am wrong, but why would long totalAmount (note lowercase L) fail to compile? And why would money.getValue() returning null fail to account for the symptoms?
  • Sergey Kalinichenko
    Sergey Kalinichenko about 9 years
    @tucuxi if totalAmount were long, not Long, this assignment from the exception handler would not compile: totalAmount = null; Returning null from money.getValue() would definitely account for the symptoms, but I think that it is a lot less likely, because OP uses exceptions rather than returning nulls in situations where results are unknown (say, because the currency conversion fails).
  • tucuxi
    tucuxi about 9 years
    ouch - should have seen it. I was looking for my clues further up.
  • eSp
    eSp about 9 years
    Will try this approach first as I was under this same impression but disregarded it for some reason. Thanks, will come back with some feedback
  • eSp
    eSp about 9 years
    @dasblinkenlight Many thanks, it worked like a charm. A lesson I won't forget (hopefully) =)